Entity Framework Vs Stored Procedures - Performance Measure

后端 未结 3 1257
轮回少年
轮回少年 2020-12-07 14:50

I\'m trying to establish how much slower Entity Framework is over Stored Procedures. I hope to convince my boss to let us use Entity Framework for ease of development.

3条回答
  •  失恋的感觉
    2020-12-07 15:07

    There are some things you can do to optimize your query. Here on MSDN you can find a nice overview.

    But to be honest, a stored procedure with manual mapping will always be faster in performance. But ask yourself, how important is performance? In most projects, development time is way more important then performance. What was harder to develop? The raw query with parsing or the Entity Framework query?

    ORMs are not designed because they perform so much better than a hand written approach. We use them because development is so much easier!

    If you write your application with the Entity Framework and hide all your queries behind a repository pattern you can develop real quick and then, when performance becomes an issue, measure your application to detect the bottleneck. Then maybe some of your queries need optimization and can be moved to stored procedures and manual mapping.

提交回复
热议问题