【发布时间】:2011-03-24 16:07:38
【问题描述】:
我最近将我的 NHibernate 实现从版本 2.1.0 更改为 2.1.2。对于延迟加载,我使用了 LinFu 实现:NHibernate.ByteCode.Linfu。
由于我更改为最新版本,因此出现以下错误:
[SecurityException: That assembly does not allow partially trusted callers.]
NHibernate.ByteCode.LinFu.ProxyFactory..cctor() +0
调试时遇到如下错误:
at NHibernate.ByteCode.LinFu.ProxyFactory..ctor()
at NHibernate.ByteCode.LinFu.ProxyFactoryFactory.BuildProxyFactory()
at NHibernate.Tuple.Entity.PocoEntityTuplizer.BuildProxyFactoryInternal(PersistentClass class, IGetter getter, ISetter setter)
at NHibernate.Tuple.Entity.PocoEntityTuplizer.BuildProxyFactory(PersistentClass persistentClass, IGetter idGetter, ISetter idSetter)
at NHibernate.Tuple.Entity.AbstractEntityTuplizer..ctor(EntityMetamodel entityMetamodel, PersistentClass mappingInfo)
at NHibernate.Tuple.Entity.PocoEntityTuplizer..ctor(EntityMetamodel entityMetamodel, PersistentClass mappedEntity)
at NHibernate.Tuple.Entity.EntityEntityModeToTuplizerMapping..ctor(PersistentClass mappedEntity, EntityMetamodel em)
at NHibernate.Tuple.Entity.EntityMetamodel..ctor(PersistentClass persistentClass, ISessionFactoryImplementor sessionFactory)
at NHibernate.Persister.Entity.AbstractEntityPersister..ctor(PersistentClass persistentClass, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory)
at NHibernate.Persister.Entity.SingleTableEntityPersister..ctor(PersistentClass persistentClass, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping mapping)
at NHibernate.Persister.PersisterFactory.CreateClassPersister(PersistentClass model, ICacheConcurrencyStrategy cache, ISessionFactoryImplementor factory, IMapping cfg)
at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners)
at NHibernate.Cfg.Configuration.BuildSessionFactory()
at MyApplication.SessionManager..ctor() in C:\Projects\MyApps\MyApplication\SessionManager.cs:line 75
这是因为使用了 NHibernate.ByteCode.LinFu 吗?我该怎么做才能让应用程序再次运行?
【问题讨论】:
-
你是否也更新了依赖库? (林福就是其中之一)
-
我更新了 Nhibernate.ByteCode.Linfu ,不需要更新 Linfu.DynamicProxy。查看引用的帖子,我也尝试使用 ByteCode.Castle,但这也不起作用。
-
你确定你的 LinFu 是用部分信任标志编译的吗?您是否尝试过预先生成代理? nhforge.org/wikis/howtonh/…
-
你终于设法解决/解决这个问题了吗?
标签: nhibernate linfu-dynamicproxy