EF Code-First - Mapping stored procedures

时光总嘲笑我的痴心妄想 提交于 2019-12-22 08:28:47

问题


I'm trying to implement nested sets in my database model. To make it easy to use I would like to create stored procedures for insert/update/delete operations on my tree nodes to keep my tree in a valid state.

Is it possible to create mapping of the stored procedures in the current version of code-first model? I mean that my stored procedures will be called when for example, new entity will be added to the dbcontext.


回答1:


Code First in Entity Framework does not support Stored Procedure by default. As there is no designer we cannot even map our stored procs to the entity. There are a many scenario we have seen where we are bound to use stored procedure for any database modifications (insert/update/delete).

You can use below links, and/or google your question to find more solutions.

Using Entity Framework Code First with Stored Procedures AND Code First 4.1 : Using Stored Procedure to Insert Data



来源:https://stackoverflow.com/questions/7664449/ef-code-first-mapping-stored-procedures

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!