开发者

Using Same Stored Procedure for Both Insert and Update in Entity Framework

I have a stored procedure that does both the insert and the update in one fell swoop (if the i开发者_运维技巧d == 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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜