开发者

EF Code-First - Mapping stored procedures

开发者 https://www.devze.com 2023-04-11 13:02 出处:网络
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 val

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 cre开发者_开发技巧ate 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.


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

0

精彩评论

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

关注公众号