views:

103

answers:

1

I have a stored procedure that does both the insert and the update in one fell swoop (if the id == 0 then it's an insert, otherwise, update). I'd love to use this for both the insert and the update methods in Entity Framework, but this isn't looking feasible. Am I correct that I'll have to split the methods into two different stored procedures, or is there a way around this?

+2  A: 

On way I would try first, is opening the EDMX in the XML editor and finding the sproc (Function) in the StorageModel element, copy it, giving it a new name.

Then you can map one actual stored procedure twice once as the Insert Modification function once as the Update Modification function.

I haven't actually tried this, but I can't see why this won't work.

Hope this helps

Alex James, Program Manager, Microsoft

Alex James
I haven't tried it either, but I agree, it should work. I just wound up re-writing the sprocs.
MasterMax1313