gpt4 book ai didi

linq - NHibernate、NHibernate.Linq 和 FluentNHibernate? throw 错误

转载 作者:行者123 更新时间:2023-12-04 06:29:12 24 4
gpt4 key购买 nike

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

Fluent NHibernate? Am I doing this correctly?

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

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:\Development\DefaultCollection\Sandboxes\Sean\NHibernateExample\NHibernateExample\bin
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:\Development\DefaultCollection\Sandboxes\Sean\NHibernateExample\NHibernateExample\web.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.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 是过时的 AFAIK,因为它属于版本 2 并且在版本 3.0 中,Linq 功能在 NHibernate 程序集本身中

关于linq - NHibernate、NHibernate.Linq 和 FluentNHibernate? throw 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5645250/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com