C# 方法';生成';在xxx类型中,没有更新的实现-S#arp
我一直在使用S#arp,并更新了C# 方法';生成';在xxx类型中,没有更新的实现-S#arp,c#,fluent-nhibernate,castle-windsor,s#arp-architecture,typeloadexception,C#,Fluent Nhibernate,Castle Windsor,S#arp Architecture,Typeloadexception,我一直在使用S#arp,并更新了AutoPersistenceModelGenerator中的Generate方法,以使用Fluent NHibernate 1.1。我还将其程序集名称从MyProject.Data更改为MyProject.Infrastructure,我不确定是哪一个导致了问题: public AutoPersistenceModel Generate() { return AutoMap.Assemblies(new myProjectMapp
AutoPersistenceModelGenerator
中的Generate
方法,以使用Fluent NHibernate 1.1。我还将其程序集名称从MyProject.Data更改为MyProject.Infrastructure,我不确定是哪一个导致了问题:
public AutoPersistenceModel Generate()
{
return AutoMap.Assemblies(new myProjectMappingConfiguration(),
typeof (MyClass).Assembly)
.Conventions.Setup(GetConventions())
.IgnoreBase<Entity>()
.IgnoreBase(typeof (EntityWithTypedId<>))
.UseOverridesFromAssemblyOf<AutoPersistenceModelGenerator>();
}
…它引发此异常:
来自程序集“MyProject.Infrastructure,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null”的类型“MyProject.Infrastructure.NHibernateMap.AutoPersistenceModelGenerator”中的方法“Generate”没有实现
我已经彻底清理了项目并重新构建了它,但错误仍在发生
我不知道这是否有区别,但上面的方法实际上是在Global.asax中直接调用的:
private void InitializeNHibernateSession()
{
var cfg = NHibernateSession.Init(
webSessionStorage,
new string[] { Server.MapPath("~/bin/MyProject.Infrastructure.dll") },
new AutoPersistenceModelGenerator().Generate(),
Server.MapPath("~/NHibernate.config"));
}
我已尝试删除IOC注册,但此方法会引发相同的错误:
public void Initialize(Action initMethod)
{
if (!this.NHibernateSessionIsLoaded)
{
lock (syncLock)
{
if (!this.NHibernateSessionIsLoaded)
{
initMethod();
this.NHibernateSessionIsLoaded = true;
}
}
}
}
更新
我重新创建了我的项目,并再次取消了相同的过程-当我将Fluent NHibernate从1.0更新到1.1时,错误似乎发生了。知道为什么吗?我相信这是由于部分S#arp架构程序集引用了旧的Fluent NHibernate版本造成的
我将S#arp程序集更新为1.6(现在使用FNH 1.1),现在可以使用了。我认为这是由于部分S#arp架构程序集引用了旧的Fluent NHibernate版本造成的
我将S#arp程序集更新为1.6(现在使用FNH 1.1),现在可以使用了。我遇到了同样的问题,但还没有准备好更新我的sharparch版本,而且我使用的是fluentnhibernate的2.0.0.0版本。您可以通过在app.config或web.config中使用程序集绑定重定向来解决此问题。像这样:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FluentNhibernate" publicKeyToken="8aa435e3cb308880" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
我遇到了同样的问题,但我还没有准备好更新我的sharparch版本,而且我正在使用fluentnhibernate的2.0.0.0版本。您可以通过在app.config或web.config中使用程序集绑定重定向来解决此问题。像这样:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FluentNhibernate" publicKeyToken="8aa435e3cb308880" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
您确定没有加载较旧版本的程序集吗?可能是从GAC加载的?请参阅:您确定没有加载较旧版本的程序集--可能是从GAC加载的吗?见: