实体框架与存储过程之 [英] Entity Framework vs Stored Procedures

查看:114
本文介绍了实体框架与存储过程之的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是开始实体框架和我AP preciate code的在我的数据库中的表的直接映射。我不明白,只是还没有是不必使用EF在存储过程的实用性和这个我会AP preciate任何人的意见。我不是懒惰,我在这一刻搜索自己。以为我可以张贴问题,听到别人为好。

I am only starting with Entity Framework and I appreciate the direct mapping of code to the tables in my database. What I do not see just yet is the practicality of having to use EF over stored procedures and I would appreciate anyone's opinion about this. I am not being lazy and I am searching this myself at the moment. Thought I can post the question and hear from others as well.

我的情况是EF作为一个ORM是在我的数据库表中最适合的映射。但在现场网络服务器许多请求可以在同一时间,可能会在具有编译文本查询被征税数据库之前执行他们相比,只是简单地执行存储过程,它是发生$ P $对编译已经。 EF也可以映射到的SP,但我觉得这是有点减少ORM的价值。

My case is EF being an ORM is most suited to mapping in the tables in my database. But in a live web server many requests can happen at one time that may be taxing the database in having to compile the text queries prior to executing them compared to just simply executing stored procedure which are pre-compiled already. EF can also map to SPs but I feel that this is somewhat diminishing the value of ORM.

我真的AP preciate开眼界在这种情况下。

I would really appreciate an eye-opener in this case.

推荐答案

只是因为EF不使用存储过程,但这并不意味着它运行参数化查询将不会被编译和缓存。 SQL Server的已经得到了很多关于更聪明多年了。

Just because EF isn't using sprocs, it doesn't mean that the parameterised queries it runs won't get compiled and cached. SQL Server has got a lot more clever about that over the years.

这篇关于实体框架与存储过程之的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆