NHibernate, NHibernate.Linq和FluentNHibernate?抛出错误



我在上一个问题中有以下错误:

连贯NHibernate吗?我这样做对吗?

但是,现在,当我调用函数:

LoginRepository login = new LoginRepository();
var allLogins = login.GetAllLogins().ToList();

抛出错误:

Could not load file or assembly 'NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

问题的根源是NHibernate.Linq。FusionLog目录如下:

=== Pre-bind state information ===
LOG: User = Sean
LOG: DisplayName = NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4 (Fully-specified)
LOG: Appbase = file:///C:/Development/DefaultCollection/Sandboxes/Sean/NHibernateExample/NHibernateExample/
LOG: Initial PrivatePath = C:DevelopmentDefaultCollectionSandboxesSeanNHibernateExampleNHibernateExamplebin
Calling assembly : NHibernate.Linq, Version=1.1.0.1001, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:DevelopmentDefaultCollectionSandboxesSeanNHibernateExampleNHibernateExampleweb.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:WindowsMicrosoft.NETFrameworkv4.0.30319configmachine.config.
LOG: Post-policy reference: NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/d33a79ac/1e32c532/NHibernate.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/d33a79ac/1e32c532/NHibernate/NHibernate.DLL.
LOG: Attempting download of new URL file:///C:/Development/DefaultCollection/Sandboxes/Sean/NHibernateExample/NHibernateExample/bin/NHibernate.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

我使用NuGet获取最新版本的NHibernate, NHibernate。Linq和FluentNHibernate

有谁能给我指个方向吗?

再次感谢!

你应该运行兼容的包,你的NHibernate版本是2.1.2.4,不是最新的。

首先添加对NHibernate 3.0和NHibernate的引用。Linq被淘汰了,因为它属于版本2而在版本3.0中Linq功能在NHibernate程序集中

相关内容

  • 没有找到相关文章

最新更新