NHibernate.Bytecode.Unity - 没有Not.LazyLoad()创建代理实例失败的异常

时间:2013-09-24 06:04:00

标签: c# .net nhibernate fluent-nhibernate unity-container

我有NHibernate和NHibernate.Bytecode.Unity作为代理工厂的.NET项目,我也使用Unity作为DI容器。我遇到了下一个问题 - 当我尝试在查询时调用.ToList()方法时,我有这个例外:

Resolution of the dependency failed, type = "CRM.Data.Entity.DealTaskStage", name = "CRM.Data.Entity.DealTaskStage".
Exception occurred while: while resolving.
Exception is: ArgumentNullException - Value cannot be null.
Parameter name: arguments
-----------------------------------------------
At the time of the exception, the container was:

  Resolving CRM.Data.Entity.DealTaskStage,CRM.Data.Entity.DealTaskStage

我有下一个关系配置(使用FluentNHibernate):

References<DealTaskStage>(x => x.Stage).ForeignKey("stage_id");

如果我将Not.LazyLoad()附加到此配置,则不会出现错误,但我想找到更好的解决方案。那么,任何人都可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

问题解决了 - 最新的NHibernate不需要任何代理提供商。

Configure NHibernate 3.3.1 for Castle Windsor after 3.0 upgrade