我一直在使用S arp,并更新了
Generate
方法在
AutoPersistenceModelGenerator
与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>();
}
在城堡温莎登记包含上述方法的大会…
container.Register(
AllTypes.Pick()
.FromAssemblyNamed("MyProject.Infrastructure")
.WithService.FirstNonGenericCoreInterface("MyProject.Core"));
…它抛出了这个异常:
程序集“myproject.infrastructure,version=1.0.0.0,culture=neutral,publicKeyToken=null”中类型“myproject.infrastructure.nhibernatemaps.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"));
}
我试过取消国际奥委会的注册,但同样的错误也会出现在这个方法上:
public void Initialize(Action initMethod)
{
if (!this.NHibernateSessionIsLoaded)
{
lock (syncLock)
{
if (!this.NHibernateSessionIsLoaded)
{
initMethod();
this.NHibernateSessionIsLoaded = true;
}
}
}
}
更新
我重新创建了我的项目,并再次取消了相同的过程——当我将fluent nhibernate从1.0更新到1.1时,就会出现错误。有什么想法吗?