EF Code-First - Mapping stored procedures
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
精彩评论