NHibernate LinFu.DynamicProxy System.IndexOutOfRangeException

时间:2019-07-04 06:23:35

标签: c# nhibernate linfu-dynamicproxy

有时候,我会遇到这样的异常:

System.IndexOutOfRangeException
   в System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   в LinFu.DynamicProxy.ProxyCache.StoreProxyType(Type result, Type baseType, Type[] baseInterfaces)
   в LinFu.DynamicProxy.ProxyFactory.CreateProxyType(Type baseType, Type[] baseInterfaces)
   в LinFu.DynamicProxy.ProxyFactory.CreateProxy(Type instanceType, IInterceptor interceptor, Type[] baseInterfaces)
   в NHibernate.ByteCode.LinFu.ProxyFactory.GetProxy(Object id, ISessionImplementor session)

发生这种情况时,我必须重新启动我的应用程序。 NHibernate配置文件如下所示:

<?xml version="1.0"?>

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
        <property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
        <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>      
        <property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
        <property name="show_sql">false</property>
        <property name="current_session_context_class">web</property>
        <property name="cache.use_second_level_cache">false</property>
        <property name="cache.default_expiration">300</property>
        <property name="command_timeout">600</property>
        <property name="cache.use_query_cache">false</property>
        <property name="cache.provider_class">NHibernate.Caches.MemCache.MemCacheProvider,NHibernate.Caches.MemCache</property>
    </session-factory>
</hibernate-configuration>

我不明白为什么会这样。有人有主意吗?

0 个答案:

没有答案