问题描述
我是NHibernate的新手,一直在尝试着用它来运行,Fluent NHibernate和NHProf使用NuGet。阅读本文后()似乎v3.1不应该直接安装,但是,在使用NuGet成功安装NHibernate 3.2和NHProf之后,我无法安装Fluent NHibernate,因为它说已经引用了NHibernate的新版本。另外,当我运行我的应用程序时,出现以下错误:无法加载文件或程序集NHibernate.ByteCode.Castle或者一个的依赖关系。以下链接()建议安装了一些额外的程序集,这正是我希望通过首先使用NuGet避免的。
在这一点上,它会更容易遵循步骤在NHForge上获取和运行的NuGet上的包似乎不兼容?解决方案NHibernate 3.2自带它自己的代理工厂。如果您正在使用配置文件,则只需要删除proxyfactory配置属性。
我相信你使用的Fluent NHibernate的版本默认使用NHibernate.ByteCode.Castle。在这种情况下,你需要用内置的NHibernate 3.2代理工厂来覆盖这个设置:
.ProxyFactoryFactory(NHibernate。 Bytecode.DefaultProxyFactoryFactory,NHibernate)
I'm new to NHibernate and have been trying to get up and running with it, Fluent NHibernate and NHProf using NuGet. After reading this article (http://gurustop.net/blog/2011/03/13/nhibernate-3-1-0-on-nuget-important-details) it seems that v3.1 shouldn't be directly installed, however, there appears no such warning for v3.2.
After successfully installing NHibernate 3.2 and NHProf using NuGet, I'm unable to install Fluent NHibernate as it says it's "Already referencing a newer version of NHibernate".
Also, when I run my app I get the following error "Could not load file or assembly 'NHibernate.ByteCode.Castle' or one of its dependencies". The following link (Could not load file or assembly in NHibernate) suggests installing a number of additional assemblies, which is what I was hoping to avoid by using NuGet in the first place.
At this point would it just be easier to follow the steps on NHForge to get things up and running as the packages on NuGet don't appear to be compatible?
NHibernate 3.2 comes with its own proxy factory. If you're using a config file, you just need to remove the proxyfactory configuration property.
I believe the version of Fluent NHibernate that you're using defaults to use NHibernate.ByteCode.Castle. In that case, you would need to override that setting with the built in NHibernate 3.2 proxy factory:
.ProxyFactoryFactory("NHibernate.Bytecode.DefaultProxyFactoryFactory, NHibernate")
这篇关于用NuGet安装NHibernate 3.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!