Using Same Stored Procedure for Insert and Update in Entity Framework

I have a stored procedure that does both insert and update in one fell swoop (if id == 0, then it's insert, otherwise it's update). I would like to use this for both insert and update methods in Entity Framework, but it doesn't seem feasible. Am I fixing that I will have to split the methods into two different stored procedures, or is there a way around this?

+2


source to share


1 answer


Along the way, I will first try to open the EDMX in an XML editor and find sproc (Function) in the StorageModel, copy it by giving it a new name.

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

I haven't actually tried this, but I don't understand why it won't work.



Hope it helps

Alex James, Program Manager, Microsoft

+2


source







All Articles