简体   繁体   中英

Using stored procedures in code-first approach?

I am using code-first approach in Entity Framework v6.1.3.

My question is: I am using a code-first approach, should I also inject the stored procedures through my entities or should I just go to my database and create a stored procedure there?

What will be the best method to address the same?

You are using code first, do not create stored procedures. The point of switching to a ORM is to move away from manually adding code directly into SQL. Entity framework provides a way to use existing stored procedures so you don't have to rewrite an entire database but you should move away from creating new stored procedures and keep your business logic where it has always belonged, in the application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM