简体   繁体   English

Castle,LinFu和Spring与NHibernate之间的关系是什么?

[英]What's the relationship between Castle, LinFu and Spring with NHibernate?

I am a newbie to NHibernate and a bit confused about Castle, LinFu and Spring. 我是NHibernate的新手,对Castle,LinFu和Spring有点困惑。

I understand that NHibernate helps in DDD and one can map entities to database using xml or Fluent NHibernate. 我知道NHibernate有助于DDD,并且可以使用xml或Fluent NHibernate将实体映射到数据库。 But wondering how Castle, LinFu and Spring are associated to NHibernate. 但想知道Castle,LinFu和Spring是如何与NHibernate联系在一起的。

Can anyone please shed some light or can point to any web link? 任何人都可以请一些亮点或可以指向任何网络链接?

Personally I have used Castle and LinFu. 我个人用过Castle和LinFu。 I tended to use Castle if I was using other Castle components as well, such as Windsor. 如果我使用其他Castle组件,我也倾向于使用Castle,例如Windsor。 In fact Castle have an NHibernate facility as well which can be helpful. 实际上Castle还有一个NHibernate工具也很有帮助。 I used LinFu when I didn't use any other Castle components. 当我没有使用任何其他Castle组件时,我使用了LinFu。

This blog post is slightly old but has some useful information on it: http://nhforge.org/blogs/nhibernate/archive/2008/11/09/nh2-1-0-bytecode-providers.aspx 这篇博文略显陈旧,但有一些有用的信息: http//nhforge.org/blogs/nhibernate/archive/2008/11/09/nh2-1-0-bytecode-providers.aspx

Check out the answer to these questions: 看看这些问题的答案:

What are the differences between LinFu.DynamicProxy and Castle.DynamicProxy? LinFu.DynamicProxy和Castle.DynamicProxy之间有什么区别?

NHibernate proxy class, what should I choose? NHibernate代理类,我应该选择什么?

NHibernate 2.1 Proxy Factory options - what are the differences and which to choose? NHibernate 2.1代理工厂选项 - 有什么区别和选择?

Castle and the others are used by NH to perform dependency injection and type interception. NH使用Castle和其他人来执行依赖注入和类型拦截。 NH is able to lazy-load data for example, because it creates proxies to your own types and intercepts calls to them. 例如,NH能够延迟加载数据,因为它会为您自己的类型创建代理并拦截对它们的调用。 That way it can make DB calls and populate instances in a sort of automagical way. 这样,它可以以一种自动方式进行数据库调用和填充实例。

All three of them do basically the same thing; 他们三个人做的基本相同; it's up to you to decide which one you prefer. 由你来决定你喜欢哪一个。

Although all seem comparable at first glance, I've personally avoided Linfu due to the following issue with S#arp Arhciture. 虽然乍一看似乎都具有可比性,但由于S#arp Arhciture的以下问题 ,我个人避开了Linfu。 This one bit me bad enough that I've been forever gun-shy. 这让我很糟糕,以至于我一直都很害羞。 The Castle provider has never steered me wrong. 城堡供应商从未指导过我。

As the other answers pointed out, all these providers work. 正如其他答案所指出的,所有这些提供商都有效。

For what it's worth, the dynamic-update mapping configuration (DynamicUpdate() in FluentNHibernate) seems to work only with Castle. 对于它的价值, 动态更新映射配置(FluentNHibernate中的DynamicUpdate())似乎只适用于Castle。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM