实体框架VS直接数据访问 [英] Entity Framework vs Direct Data Access

查看:104
本文介绍了实体框架VS直接数据访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直使用直接访问数据与对象在过去的处理(手动运行查询,并映射结果到数据对象)。我知道微软目前正在力推的EF为他们的客户使用查询数据对象。

我有关于几个问题,为社会这样的: -

  • 如果你有一个复杂的数据库,也就是几百表,存储过程,视图像样的数目,一切都在3NF。是管理两个模式(一个当地的EF模式映射和一个DB)值得权衡的负担?

  • 在你开始坡道的数据访问,对两个如何缓存比较?我知道,在直接访问,可以实现任何形式的缓存你想要的,并EF让类似的事情?

  • 由于后重推他们,并让人们为他们写(SQL-NS,LINQ到SQL)这是发生在EF如何likley扼杀了微软产品的历史?

正如我所说的,我目前大量使用的那一刻直接访问,但考虑迁移(即新的查询前进,而不是背弃他们都只是还没有),并一直在寻找的建议来自社会其他对自己的看法。

解决方案
  

如果你有一个复杂的数据库,也就是几百桌,   存储过程,视图体面的,一切都在3NF。是   管理两个架构的负担(一个本地EF架构映射和   带有一个DB)值得权衡?

您可以使用自动化的工具,让您的EF模式最多最新的,所以它不是真的那么坏。

  

在你开始坡道的数据访问,请问缓存比上   他们俩?我知道,在直接访问,可以实现任何形式的缓存   你想,没有EF让类似的事情?

据我所知,是的。

  

由于后重扼杀了微软产品的历史   推他们,并让人们为他们写(SQL-NS,   LINQ到SQL)如何likley这是发生在EF?

这个问题实在太假设。

我在使用EF的问题是它的性能。是啊,你得到快速发展,但权衡性能。随着EF它真的很容易写坏的和缓慢的code,如果你不100%知道自己在做什么,你可能会得到一些严重的性能问题以后(特别是如果你正在处理上百个表)。

什么我建议是尝试一些微ORM框架,如小巧玲珑或​​块状。你不牺牲那么多的性能,但它更容易比传统的Ado.net的方法来维护。

但是,嘿,这就是我,你可能喜欢EF。

I've always used direct data access for dealing with objects in the past (manually running a query, and mapping the results into data objects). I know Microsoft is currently pushing EF for their customers to use for querying data objects.

I've got a few questions for the community in respect to this :-

  • If you have a complex database, i.e. a couple of hundred tables, a decent amount of stored procedures, views, everything is in 3NF. Is the burden of managing two schemas (one local EF schema mapping and one DB) worth the trade off?

  • Once you start to ramp up the data access, how does caching compare on the two? I know in Direct access you can implement any form of caching you want, does EF allow something similar?

  • Given Microsoft's history of killing off products after heavily pushing them and getting people to write for them (SQL-NS, Linq-to-Sql) how likley is this to happen to EF?

As I said I'm currently heavily using Direct Access at the moment, but considering a migration (i.e with new queries going forward, not backtracking on them all just yet), and was looking for advice from the rest of the community on their views.

解决方案

If you have a complex database, i.e. a couple of hundred tables, a decent amount of stored procedures, views, everything is in 3NF. Is the burden of managing two schemas (one local EF schema mapping and one DB) worth the trade off?

You can use automated tools to keep your EF schema up-to-date, so it's not really that bad.

Once you start to ramp up the data access, how does caching compare on the two? I know in Direct access you can implement any form of caching you want, does EF allow something similar?

As far as I know, yes.

Given Microsoft's history of killing off products after heavily pushing them and getting people to write for them (SQL-NS, Linq-to-Sql) how likley is this to happen to EF?

This question is far too hypothetical.

The issue I'm having with EF is it's performance. Yea, you get rapid development, but trading off performance. With EF it's really easy to write a bad and slow code and if you don't 100% know what you're doing, you may end up with some serious performance issues later on (especially if you're dealing with hundreds of tables).

What I'd suggest is to try some Micro-ORM frameworks, like Dapper or Massive. You don't sacrifice that much performance, but it's easier to maintain than traditional Ado.net approach.

But hey, that's just me, you may love EF.

这篇关于实体框架VS直接数据访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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