NHibernate 或 LINQ to SQL [英] NHibernate or LINQ to SQL
问题描述
如果开始一个新项目,您会为 ORM NHibernate 或 LINQ 使用什么以及为什么.各自的优缺点是什么.
If starting a new project what would you use for your ORM NHibernate or LINQ and why. What are the pros and cons of each.
LINQ to SQL 不仅仅是 LINQ(感谢 @Jon Limjap)
edit: LINQ to SQL not just LINQ (thanks @Jon Limjap)
推荐答案
我问过自己一个非常相似的问题,除了我考虑的是 WilsonORM 而不是 NHibernate,我认为它非常好.
I have asked myself a very similar question except that instead of NHibernate I was thinking about WilsonORM which I have consider pretty nice.
在我看来,有很多重要的区别.
It seems to me that there are many important differences.
LINQ:
- 不是一个完整的 ORM 工具(你可以使用一些额外的库,比如最新的实体框架 - 我个人认为与其他 ORM 框架相比,MS 的这项最新技术的架构大约有 10 年的历史)莉>
- 主要查询支持智能感知的语言"(编译器将检查查询的语法)
- 主要用于 Microsoft SQL Server
- 是闭源的
NHibernate:
NHibernate:
- 是ORM工具
- 没有智能感知的查询语言非常有限
- 几乎可以与您拥有 DB 提供程序的任何 DBMS 一起使用
- 是开源的
这真的取决于.如果您开发了一个 Rich (Windows) 桌面应用程序,您需要在其中构造对象、使用它们并最终保留它们的更改,那么我会推荐像 NHibernate 这样的 ORM 框架.
It really depends. If you develop a Rich (Windows) desktop application where you need to construct objects, work with them and at the end persist their changes, then I would recommend ORM framework like NHibernate.
如果您开发的 Web 应用程序通常只查询数据并且只是偶尔将一些数据写回数据库,那么我会推荐像 Linq 这样好的查询语言.
If you develop a Web application that usually just query data and only occasionally writes some data back to the DB then I would recommend good querying language like Linq.
一如既往,这取决于.:-)
So as always, it depends. :-)
这篇关于NHibernate 或 LINQ to SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!