nHibernate 与 LLBLGen Pro

发布于 2024-07-26 22:27:20 字数 281 浏览 1 评论 0原文

我正在尝试使用 ORM 工具来移动并已将其范围缩小到两个候选者。

nHibernateLLBLGen Pro

请你们告诉我使用这两个工具的优点和缺点,特别是如果您在这两个方面都有经验的话。 我对任何其他工具并不真正感兴趣,但我想要一些提示,以便我可以决定花时间学习哪个工具......

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

非常感谢,理查德

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

nHibernate or LLBLGen 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....

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

Many thanks, Richard

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

指尖凝香 2024-08-02 22:27:21

我们在工作中使用 LLBLGen,但它受到了谩骂——即因为我们有多个相似的模式,但每个模式都需要不同的 DLL/类库,这意味着编写可以针对任何模式的代码会变得很烦人。

当然,这是一个不寻常的环境,所以它可能不适用于您。

We use LLBLGen at work, and it's reviled -- namely because we have multiple similar schemas, but you need to have a different DLL/Class library for each schema, meaning that it becomes annoying to write code that can target any schema.

Of course, that's an unusual environment, so it may not apply to you.

烟花易冷人易散 2024-08-02 22:27:20

我都用过。 起初,我被 nHibernate 迷住了,并且拒绝尝试其他任何东西,尽管我知道还有其他选择。

对于 LLBLGen Pro,我很怀疑,但很快也看到了它的优点。 我还没有完全放弃 nHibernate。 我将继续在我的“工具箱”中保存信息。 我发现 LLBLGen 在某些情况下很有用,特别是在与已经存在的数据库交互并且您无法选择重新设计它时。 从数据库生成 LLBLGen 实体对象需要不到一个小时(当然取决于数据库的大小),而不是必须使用 nHibernate 手动编码所有对象并进行映射。 nHibernate 缺少一个漂亮的图形界面来创建映射。 当数据库非常庞大,并且您需要在应用程序中访问数千个表时,这一事实就变得更加重要。

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

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

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

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

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

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.

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.

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.

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).

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.

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.

萌无敌 2024-08-02 22:27:20

主要区别在于 LLBLGen 是一个代码生成器,而 NHibernate 是一个“真正的”ORM 库。

LLBLGen 优点

  • 易于使用的模型设计器。 可以导入现有的数据库模式
  • 完全类型化的对象模型和查询语言

LLBLGen 缺点

  • 您需要设计器应用程序来更改您的模型
  • 不免费
  • 会导致代码膨胀,因为生成了大量代码

NHibernate 优点

  • 无需设计器应用程序。 仅代码
  • 广泛使用(基于最流行的 Java ORM、Hibernate)
  • 非常强大,可以映射您可以想象的任何数据模型
  • 开源

NHibernate 缺点

  • 难以学习
  • 不像人们希望的那样强类型(尤其是疑问)

当然,这只是我个人的观点......

The major difference is that LLBLGen is a code generator, while NHibernate is a "true" ORM library.

LLBLGen advantages:

  • Easy to use model designer. Can import your existing database schema
  • Fully typed object model and query language

LLBLGen disadvantages:

  • You need the designer application to change your model
  • Not free
  • Can bloat your code because a lot of code is generated

NHibernate advantages:

  • No designer application needed. Only code
  • Widely used (based on the most popular Java ORM, Hibernate)
  • Very powerful for mapping any data model you can imagine
  • Open source

NHibernate disadvantages:

  • Hard to learn
  • Not as strongly typed as one would like (especially queries)

Of course, this is just my personal point of view...

三寸金莲 2024-08-02 22:27:20

在意识到这是一个有点老的问题之前,我输入了一个相当长的答案。 那好吧。 这仍然是非常相关的。

您已将列表范围缩小到 .NET 世界中 ORM 的两个最佳候选者。 我对两者的经验都有限,但我广泛阅读了两者的优缺点。 他们确实以不同的方式满足不同的需求。

在即将推出的 LLBLGen Pro 3.0 中,Frans Bouma 谈到了添加生成 NHibernate 映射的功能。 因此,这甚至不一定是一个非此即彼的决定。

如果您想做“类优先”设计(而不是“数据库优先”设计),NHibernate 几乎是您目前最好也是唯一的选择(LLBLGen Pro 和实体框架都不支持这种模式,尽管听起来实体框架是在下一个版本中改进它的支持)。

NHibernate 和 LLBLGen Pro 都努力与您无法更改且必须忍受的遗留数据库良好配合。 这是他们共同的力量。 他们也都使用 Linq。 它们都还支持一定量的图形建模,尽管 LLBLGen Pro 在这方面要优越得多(ActiveWriter for NHibernate 感觉就像 Visual Studio 中的 LinqToSql 设计器,但它的功能并不丰富)。

LLBLGen Pro 具有更强的代码生成能力,但过多的代码生成可能会导致可测试性和可维护性受损(一个小小的调整可能会导致大量代码需要重新测试)。

虽然 NHibernate 希望帮助您处理相当复杂的对象/关系映射场景(例如类继承),但 LLBLGen Pro 实际上只是以非常快速的方式将您的数据库公开为数据层和业务对象。

如果您可以购买 LLBLGen Pro 并且有时间,我会尝试两者,看看哪一个更能满足您的需求。 无论如何,学习这两种 ORM 对你的简历都有好处。

所以,最后我想说,这是分情况的。 NHibernate 的成本及其缺乏严重缺陷在大多数情况下都是相当令人信服的。

I typed up a fairly long answer before realizing this was a somewhat old question. Oh well. It's still very relevant.

You have narrowed your list to the two best candidates for an ORM in the .NET world. I have limited experience with either, but I've read extensively about the pros and cons of both. They really serve somewhat different needs in different ways.

In the upcoming LLBLGen Pro 3.0, Frans Bouma has talked about adding features to generate NHibernate mappings. So, it's not even necessarily an either/or decision.

If you want to do "class first" design (as opposed to "database first" design), NHibernate is pretty much your best and only option right now (neither LLBLGen Pro nor Entity Framework support this mode, although it sounds like Entity Framework is improving it's support in the next version).

NHibernate and LLBLGen Pro both work hard to work well with legacy databases which you can not change and have to live with. That is their common strength. They both also work with Linq. They both also support some amount of graphical modeling, although LLBLGen Pro is far superior in this regard (ActiveWriter for NHibernate feels like the LinqToSql designer in Visual Studio, but it's not really as feature rich).

LLBLGen Pro has much stronger code generation abilities, but too much code generation can lead to compromised testability and maintainability (one small tweak can cause massive amounts of code to need retesting).

While NHibernate wants to help you work through fairly complex object/relational mapping scenarios like class inheritance, LLBLGen Pro is really just exposing your database as a data layer and business objects in a very quick way.

If you can purchase LLBLGen Pro and have some time, I would try both and see which one better meets your needs. Learning both ORMs is good for your resume in any case.

So, in the end, I would say it's situational. The cost of NHibernate and its lack of serious flaws make a pretty compelling case in the majority of situations.

烟柳画桥 2024-08-02 22:27:20

新版本的LLBLGen Pro (3.0)允许您为NHibernate生成代码,所以不必选择:)。 它还允许您将实体分割到不同的域中。

不过,我仍然更喜欢 LLBLGen pro 运行时,LINQ 解释器更完整,并且具有更好的字段更改跟踪功能。

不幸的是,新的 LLBLGen Pro 3.0 运行时中没有太多新功能,因为创建者首先希望更多地关注工具而不是改进现有框架。

The new version of LLBLGen Pro (3.0) allows you to generate code for NHibernate, so don't have to choose :). It also allows you to split up your entities into different domains.

I still prefer the LLBLGen pro runtime though, the LINQ interpreter is more complete and it has better change tracking of fields.

Unfortunately there's not many new features in the new LLBLGen Pro 3.0 runtime, as the creator first wanted to focus more on tooling than improving the existing framework.

帝王念 2024-08-02 22:27:20

我使用过 nHibernate、LLBLGen Pro、我的咨询公司的自定义数据层、Enterprise Library 和 LINQ。 LLBLGen 是迄今为止我最喜欢的,它允许编写一个业务层,可以使用提供数据库独立性的相同代码与不同类型的数据库进行通信! 另一个令人难以置信的功能是它允许与不同数据库的多个连接。 当在一家大公司,一个系统是用 Sql Server 编写的,而另一个系统是用 Oracle 编写的时,这非常有用。

LLBLGen Pro 是一款令人惊叹的产品,由 Frans 支持,他非常活跃并努力解决问题。 LLBLGen 就像 PhotoShop,它是一个令人难以置信的工具,在知道如何使用的人手中可以产生惊人的效果。 与任何节省大量时间的工具一样,学习如何使用它需要一两周的时间,但会在您的项目后节省几个月的时间。

它不仅加快了我的应用程序的 DAL 生成速度,还可以轻松在业务层中创建查询并将其发送到表示层。 它使创建企业级应用程序变得容易。

如果确实想使用 nHibernate,请从 LLBLGen Pro 开始并生成 nHibernate 代码。 如果稍后您的部门决定从 nHibernate 切换到 LINQ,那么您也能得到保障。 想要从 Sql Server 切换到 Oracle? 使用 LLBLGen 可以做到这一点并且相对容易,而使用手动编码的 nHibernate 代码,您必须重写所有内容,这几乎不可能证明成本合理。

弗兰斯也有空并回答了我的一些问题。

I've used nHibernate, LLBLGen Pro, a custom data layer from my consulting company, the Enterprise Library, and LINQ. LLBLGen is by far my favorite and it allows writing one business layer that can talk to different types of databases using the same code providing database independence! Another incredible feature is it allows multiple connections to different databases. This is very useful when at a large company and one system is written in Sql Server and the other you have to interface with is in Oracle.

LLBLGen Pro is an amazing product backed up by Frans who is very active and works hard to fix issues. LLBLGen is like PhotoShop, it is an incredible tool and that can do amazing effects in the hands of someone who knows how to use. And like any tool that saves lots of time, it takes a week or two to learn how to use it, but will save months later on your project.

Not only did it speed up the DAL generation side of my app, it is also easy to create queries in the Business layer and send to the presentation layer. It made it easy to create an enterprise class application.

If one really wants to use nHibernate, start with LLBLGen Pro and generate the nHibernate code. If later on your department decides to switch from nHibernate to LINQ, you are covered. Want to switch from Sql Server to Oracle? This is possible and relatively easy with LLBLGen whereas with manually coded nHibernate code, you have to rewrite everything which is almost impossible to cost justify.

Frans was also available and answered some of my questions.

讽刺将军 2024-08-02 22:27:20

不要忘记 Hibernate 最大的优点之一:HQL。 有了 HQL,你的 SQL 技能就不会被浪费。 Hibernate 还为本机查询提供了非常好的、无缝的支持。
如果您有一些奇怪的、不符合标准的数据库,几乎可以肯定您在某些时候需要 SQL 技能,祝 LLBL 好运!

Don't forget one of the greatest plus point of Hibernate: HQL. With HQL, your SQL skill is not wasted. And Hibernate provides very nice, seamless support for native query as well.
If you have some weird, out-of-standard database, it's almost certain that you need your SQL skill at some point, and good luck with LLBL!

愁杀 2024-08-02 22:27:20

对我来说,它可以归结为以数据库为中心(LLBLGen Pro)与以领域模型为中心(NHibernate)。

由于我是一个 DDD/OO 人,所以选择对我来说一直很容易,但我确实明白为什么 LLBLGen Pro 很受欢迎。

For me it boils down to database centric (LLBLGen Pro) vs. domain model centric (NHibernate).

Since I'm a DDD/OO guy, the choice has always been very easy for me, but I do see why LLBLGen Pro is popular.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文