Entity Framework and Stored Procedures

I'm just starting out with the Entity Framework, and I appreciate the direct mapping of code to tables in my database. What I don't see yet is the practicality of using EF over stored procedures, and I would appreciate any opinion on that. I'm not lazy, and now I'm looking for it myself. I think I can post this question and hear from others.

In my case, EF is the ORM most suitable for matching in tables in my database. But on a real web server, there may be many queries that may be taxed in the database when compiling text queries before they are executed, compared to simply executing a stored procedure that has already been precompiled. EF can also be displayed in SP, but I feel that this somewhat reduces the value of ORM.

In this case, I would really appreciate the discovery.

+7
source share
3 answers

Just because EF does not use sprocs does not mean that programmed requested requests will not be compiled and cached. Over the years, SQL Server has possessed much smarter capabilities.

+2
source

You may find Jeff's comment on this topic: http://www.codinghorror.com/blog/2005/05/stored-procedures-vs-ad-hoc-sql.html .

Its essence basically lies in the fact that the stored procedure can be considered as a kind of premature optimization, and you really need to make sure that this is a performance bottleneck in your application before you go along this route. For example, there are frameworks that let you combine 1000 concurrent web requests to see how your database will actually work under load in one situation compared to another.

+3
source

One of the possible approaches: - dynamic sql for individual objects - SP for parameterized lists and orders

The value of ORM is usually its simplicity when creating an object model. One way is described here: http://www.codeproject.com/Articles/362034/Populating-a-business-logical-layer-from-stored-pr

+1
source

All Articles