I think its time for your team to become "conversant" with EF if you are going to use it. Doing every single CRUD operation with stored procedures is not the path I would take. If the stored procedure is doing something simple as:
Get the company record with ID 1
Then I would not use stored procedure and use EF. For more complex operations, stored procedures can be used. Therefore, you and your team may want to have team work session to decide on when to use stored procedures and when not to. Once you have decided, the whole team should stick to that approach. If you need to change it, have another meeting and make sure everyone is in the know. It is important for everyone to follow the same pattern once the team has agreed to it.
How to use stored procedures with EF?
I would start with one test stored procedure to see how the whole thing works. Once you and your team know exactly how the process works with EF, then put together a design, conventions etc. and then the whole team should follow the same pattern.
- Write a test stored procedure which returns a resulset.
- Create the EDMX by connecting to your database from Visual Studio.
- Add the stored procedure to your EDMX.
- Use the model browser to add a
Function Import
. This will create a method in your context which you can call like any other method, but underneath it will call your stored procedure. Please see this answer for more on how to do this step.
- Step 4 will create a class based on your stored procedure's resultset.
Note
You may need to set this flag to off, TEMPORARILY, for EF to create the complex type based on your stored procedure result set.
SET FMTONLY OFF
See this answer for more about the flag.