Nhibernate does not work after upgrading to version 2.1.2

I recently changed my NHibernate implementation from version 2.1.0 to 2.1.2. For lazy loading, I used the LinFu implementation using: NHibernate.ByteCode.Linfu.

Since I upgraded to the new version, I got the following error:

 [SecurityException: That assembly does not allow partially trusted callers.]
  NHibernate.ByteCode.LinFu.ProxyFactory..cctor() +0

When debugging, I came up with the following error:

   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

Is it because of using NHibernate.ByteCode.LinFu? What can I do to make the application work again?

+3
source share
1 answer

In cases where you have a different version of the links, that is, 2.1.0 and 2.1.2, you can configure .net to redirect calls from the old to the new or vice versa by redirecting fees ...

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="Linfu.DynamicProxy"
                                  publicKeyToken="32cd8f1a53a4c744"
                                  culture="neutral" />
                <bindingRedirect oldVersion="1.0.0.0"
                                 newVersion="1.1.0.0"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>

, , . .. . " ", , , , "NHibernate.ByteCode.LinFu.ProxyFactory..ctor()". - " ".

, ?

0

Source: https://habr.com/ru/post/1729920/


All Articles