How to add stored procedures to existing database model (in Code first Approach)?

c# ef-code-first entity-framework-6

Question

I am working on a project where code first E-F was implemented but not able to access the stored procedures.How could I add them to the model now?

1
2
11/2/2017 9:17:20 AM

Popular Answer

Well, if it's an existing database, you could just use Microsoft SQL Server Management Studio to access the stored procedures. They can be found under 'Your database' > 'Programmability' > 'Stored Procedures' in the Object Explorer. Though I'm pretty sure that using both stored procedures AND entity framework is not common practice.

To answer your question, right-click the Stored Procedures filter in the Object Explorer mentioned above and click the Stored Procedure option to add a stored procedure to your database.

If you don't want to use MSSMS, you can also add stored procedures in C# using the migration functionality that entity framework provides, explained in this question.

1
11/2/2017 9:54:34 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow