.net ORM比较 [英] .net ORM Comparison

查看:146
本文介绍了.net ORM比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和某人谈论实体框架,我还没有真正进入它,但我想学习它。但是,我仍然困惑我是否应该学习。我听说很多人说你不应该使用实体框架,但我没有听说过任何争论为什么。

I was talking with someone about the Entity Framework, and I'm not really into it yet, but I'd like to learn it. However, I'm still kinda confused whether I should learn it or not. I've heard a lot of people saying you shouldn't use the entity framwork, however I haven't heared any arguments why that is.

所以我的问题是,与其他产品相比,使用实体框架的专业人员和顾问是什么?。喜欢

So my question is, what are the pro's and con's of using the Entity Framework compared to other products. Like


  • NHibernate

  • DataObjects.Net

  • ..

在易用性,可测试性和语义方面...

In terms of ease of use, testability, semantics...

我知道有一些重复 问题。但他们都是过时的(2008,2009),说实话,论点也缺乏东西。我知道Entity Framework 4.0是可用的,我还没有找到一个很好的(完整的)比较。

I know there are some duplicate questions about this. But they are all kinda outdated (2008,2009) and to be honest, the arguments are also lacking something. I know Entity Framework 4.0 is available, and I haven't found a good (complete) comparison yet.

我的问题通过解释一些关于不同框架的细节。想到这里可能是好的,以备将来参考。

Some of the nice people here have answered my question by explaining some details on the different frameworks. Thought it might be good to show them here for future reference.

推荐答案

由于J. Tihon在解释EF特性方面做得很好,我只列出NHibernate在EF周围运行的区域:

Since J. Tihon did a great job on explaining EF features, I'll just list the areas where NHibernate runs circles around EF:


  • 缓存

    • EF没有

    • NH对于实体或集合的延迟加载组(在任何DB中)都有广泛的支持,并以同样的方式Oracle和SQL Server)。


    • EF根本没有可扩展性。它甚至不支持Enum属性

    • 在NH中没有类型映射的硬编码。您可以扩展它以支持您可以创建的任何值类型,修改现有类型映射的方式等。


    • EF仅支持简单的实体集合。多对多始终使用组合键

    • NH支持实体,值类型,组件类型的集合,以及索引集合和字典(其中键和值都可以是任意类型)。支持具有自己的键的多对多集合(idbag)


    • EF没有开箱即用。上面列出了同样的不支持的示例

    • NH具有丰富的日志记录功能,可以轻松地调试问题。默认情况下它使用log4net,但您可以使用任何您想要的日志框架


    • EF以LINQ为主要查询语言。当映射到关系数据库时,LINQ具有高阻抗。 EF的提供程序不支持使用实体作为参数;您总是必须使用Id。



    • EF几乎没有

    • NH具有强大的事件系统允许您在会话生命周期的任何时候扩展或替换其行为:加载对象,持续更改,刷新等。

    我认为可扩展性是主要的卖点。使用接口和基础库,您可以在需要时扩展,并在配置选项中显示。

    I think extensibility is the main selling point. Every aspect of NH is correctly decoupled from the rest, using interfaces and base clases that you can extend whenever you need to, and exposed in configuration options.

    EF遵循通常的方式默认关闭的MS模式,我们稍后会看到可扩展的内容。

    EF follows the usual MS pattern of making things closed by default, and we'll see what's extensible later.

    这篇关于.net ORM比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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