有什么其他的ORM的区别NHibernate的?有什么、其他的、区别、ORM

2023-09-03 21:23:36 作者:笑中有泪。

除了事实,即它是开源的,成熟的,有什么是分离的 NHibernate的从.NET ORM框架的其他部分,如差异化因素的亚音速 ADO.NET实体框架等?

Apart from the fact that it’s open source and mature, what are the differentiating factors that separate nhibernate from rest of the .net ORM frameworks like Subsonic, ADO.NET Entity Framework etc?

最好把,我为什么要选择在NHibernate的其他.NET实体框架?

Better put, why should I choose nhibernate over other .net entity frameworks?

推荐答案

最大的原因可能是NHibernate的支持持久性的无知;您的实体可以是普通的旧CLR对象(没有基类)。它还支持工作单元(更新自动跟踪和批处理)的亚音速不支持。此外,实体框架不支持隐式懒加载(当你要访问Order.OrerItems,你必须调用Order.OrerItems.Load())。它迫使你去思考延迟加载,而且严重污染的楼内设有商务逻辑和基础设施问题。

The biggest reason is probably that nHibernate supports persistence ignorance; your entities can be plain old CLR objects (no base class). It also supports unit of work (updates are automatically tracked and batched) which Subsonic does not support. Also, Entity framework does not support implicit lazy loading (when you want to access Order.OrerItems, you have call Order.OrerItems.Load()). It forces you to think about lazy loading, but also pollutes your buisness logic with infrastructure concerns.