nHibernate 与 LLBLGen Pro [英] nHibernate versus LLBLGen Pro

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

问题描述

我正在尝试使用 ORM 工具解决问题,并将其缩小到两个候选对象.

I am trying to work out with ORM tool to move over to and have narrowed it down to two candidates.

nHibernateLLBLGen Pro

请你们告诉我使用这两种工具的利弊,特别是如果你有这两种工具的经验.我对任何其他工具并不真正感兴趣,但我想要一些提示,以便我可以决定花时间学习哪个工具......

Please can you guys give me pros and cons in using both these tools especially if you have experience in both. I am not really interested in any other tools but am wanting some heads up so I can decide which tool to spend time learning....

我已经知道一个是免费的,一个不是,我也知道 nHibernate 可能需要一些学习......

I already know that one is free and one isn't, I also know that nHibernate might take some learning....

非常感谢,理查德

推荐答案

我两个都用过.起初我被 nHibernate 卖了,即使我知道其他选择,我也拒绝尝试其他任何东西.

I have used both. At first I was sold on nHibernate and refused to try anything else even though I knew about other options.

对于 LLBLGen Pro,我持怀疑态度,但很快也看到了优势.我并没有完全放弃 nHibernate.我将继续将 int 保留在我的工具箱"中.我发现 LLBLGen 在某些情况下很有用,尤其是在与已经存在的数据库进行交互时,您无法选择重新设计它.从数据库生成我的 LLBLGen 实体对象需要不到一个小时(当然取决于数据库的大小),而不是必须使用 nHibernate 手动编码所有这些,并进行映射.nHibernate 缺少一个很好的图形界面来创建映射.当数据库包含数千个您可能需要在应用程序中访问的表时,这一事实变得更加重要.

With LLBLGen Pro, I was skeptical, but soon saw the advantages as well. I have not totaly abandoned nHibernate. I will continue to keep int in my "box of tools". I have found LLBLGen useful in some cases especially when interacting with a database that already exists and you have no choice of re-designing it. It takes less than an hour (depending on size of database of course) to generate my LLBLGen Entity Objects from the database, as opposed to having to code all of it manually with nHibernate, AND do the mappings. nHibernate is missing a nice graphical interface to create the mappings. This fact becomes even more important when the database is massive with thousands of tables that you need to potentially access in your application.

尽管 LLBLGen 更像是一个数据访问层生成器(而且我通常不喜欢 DAL 生成器),但它具有许多真正的 ORM"工具所具有的功能.在我看来,它具有两全其美的优点.一旦您开始使用它,您就会开始意识到它非常灵活和可扩展.我非常喜欢的一个部分是我可以为生成的实体对象创建部分类,我可以在其中编写业务逻辑以及验证.

Although LLBLGen is more of a Data Access Layer generator (And I am not normally a fan of DAL generators), it has a lot of features a "true ORM" tool would have. In my opinion it has the best of both worlds. Once you start working with it you start to realize that it is very flexible and extendable. One part I like a lot is that it is possible for me to create partial classes for the generated entity objects, where I can code in my business logic, as well as validation.

代码生成是模板化的,因此您可以完全控制它生成的代码.使用 nHibernate,我发现自己一遍又一遍地编写一些相同类型的代码.使用 LLBLGen,我可以生成它并更快地关注业务逻辑和问题.

The code generation is templated so you have full control over the code it generates. With nHibernate I find myself writing some of the same kind of code over and over again. With LLBLGen I can generate it and get to focus on business logic and issues quicker.

对于刚开始使用 ORM 类型工具的人,我真的建议从 LLBLGen 开始,因为 nHibernate 可能会让人不知所措.最终您将获得相同的结果(或多或少).

For someone who is just starting to use ORM type tools, I really recommend to start with LLBLGen, because nHibernate can be overwhelming. And in the end you will have achieved the same result (More or less).

编辑 #1: LLBLGen 现在也 100% 支持 LINQ.(因此,如果您因此喜欢 LINQ to SQL)进一步 LLBLGen 可以支持许多数据库,其中 LINQ to SQL 仅适用于 Microsoft SQL 数据库.

Edit #1: LLBLGen now also has 100% support for LINQ. (So if you like LINQ to SQL for that reason) further LLBLGen can support many databases, where LINQ to SQL is only for Microsoft SQL Database.

编辑 #2:根据 Graviton 你可以使用 CodeSmith 为你做一些代码生成对于 nHibernate.这真的很酷,但对于 ORM 的新手,我仍然会推荐 LLBLGen.对我来说,这是添加更多依赖项,而 LLBLGen 将所有这些都包含在一个包中.同样就像我之前所说的,学习曲线没有那么陡峭,您将获得相同的好处,如果您决定去那里,这也将帮助您轻松适应 nHibernate.

Edit #2: According to Graviton you can use CodeSmith to do some of the code generating for you for nHibernate. That is really cool, but for a newcomer to ORM I would still recommend LLBLGen. To me that is adding more dependencies where LLBLGen has it all in one package. Also like I said before the learning curve is so much less steep and you will get the same benefits, which will also help you ease in to nHibernate if you ever decide to go there.

这篇关于nHibernate 与 LLBLGen Pro的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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