Write Sql stored procedure with EF code first approach?

preno 60 Reputation points
2023-05-22T14:32:42.6466667+00:00

Hello.

I am new with EF6 and I'm doing some tests with the ASP.NET MVC 5 and Code First.

As a beginner, I’m confused.

If I create model classes and then have the database (sqlserver) created by EF, can I then write stored procedures in the sqlserver database? I mean with Sql Server Management Studio.

If I change the sql server instance (for example from development to production ) do I have to rewrite them on the new sqlserver?

Developer technologies .NET Other
SQL Server Other
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-05-22T15:08:08.1233333+00:00

    Yes. You will need to recreate them. You can manually add them, or create c# code to create them and add to the EF on model creating.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.