NHibernate or FluentNHibernate or ActiveRecord?

随声附和 提交于 2019-12-06 11:53:20

Please note that any classes related to an ORM should not necessary be treated as "business object" classes or exposed to your UI. They should be considered part of your data layer. This pattern is not really unique to ActiveRecord. In general, you want your business layer to know as little as possible regarding the fact that there is an ORM beneath it, and you don't want your UI to know about your data layer. You also want to consider DTOs.

Fluent NHibernate solves the problem of having weakly typed XML which can be error prone to refactor.

While there can be downsides of adopting something like ActiveRecord, it seems like an appropriate solution in your case.

The best reason to use .hbm.xml files is if you are going to code generate them from your database (using something like CodeSmith). Hand coding the .hbm.xml files is rarely the best option.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!