NHibernate configuration StandardQueryCache Exception Find BUG

NHibernate   configuration  StandardQueryCache Exception  Find BUG

2013.06.02 

#region
            configuration.Cache(c => //(Cache)
            {
                c.UseQueryCache = DefaultUseQueryCache;
                c.UseMinimalPuts = true;
                c.RegionsPrefix = "Cache";
                c.DefaultExpiration = 60;//秒
                if (DefaultUseSecondLevelCache)
                {
                     c.Provider<HashtableCacheProvider>();//
                     c.QueryCache<StandardQueryCache>();//
                     //configuration.SetProperty(Environment.UseSecondLevelCache, "true");
                    // configuration.SetProperty(Environment.QueryCacheFactory, typeof(StandardQueryCacheFactory).FullName);
                }

            });
            #endregion


未处理 NHibernate.HibernateException

  Message=could not instantiate IQueryCacheFactory: NHibernate.Cache.StandardQueryCache, NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
  Source=NHibernate
  StackTrace:
       在 NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary`2 properties)
       在 NHibernate.Cfg.Configuration.BuildSettings()
       在 NHibernate.Cfg.Configuration.BuildSessionFactory()
       在 Com.Zfrong.Arch.Common.Data.NH.Core.NHSessionFactoryManager.BuildSessionFactory(String key) 位置 F:\Develop\Com.Zfrong.Arch\Common\Data\NH\Core\NHSessionFactoryManager.cs:行号 40
       在 Com.Zfrong.Arch.Common.Data.NH.Core.NHSessionFactoryManager.GetSessionFactory(String key) 位置 F:\Develop\Com.Zfrong.Arch\Common\Data\NH\Core\NHSessionFactoryManager.cs:行号 26
       在 Com.Zfrong.Arch.Common.Data.NH.Core.NHSessionManager.GetSessionFactory(String key) 位置 F:\Develop\Com.Zfrong.Arch\Common\Data\NH\Core\NHSessionManager.cs:行号 71
       在 Com.Zfrong.Arch.Common.Data.NH.Core.NHSessionManager.BindCurrentSession(String key, IInterceptor interceptor) 位置 F:\Develop\Com.Zfrong.Arch\Common\Data\NH\Core\NHSessionManager.cs:行号 35
       在 Com.Zfrong.Arch.Common.Data.NH.Core.NHSessionManager.BindCurrentSession(String key) 位置 F:\Develop\Com.Zfrong.Arch\Common\Data\NH\Core\NHSessionManager.cs:行号 28
       在 Com.Zfrong.Arch.Common.Data.NH.DatabaseImp.get_CurrentSession() 位置 F:\Develop\Com.Zfrong.Arch\Common\Data\NH\DatabaseImp.cs:行号 54
       在 NH.Test.test2.initData(String key, Int64 row) 位置 F:\Develop\Com.Zfrong.Arch\Common\Data\NH\test2.cs:行号 69
       在 NH.Test.test2.Test1(Int32 i, Int32 j) 位置 F:\Develop\Com.Zfrong.Arch\Common\Data\NH\test2.cs:行号 139
       在 NH.Test.test2.TestThead() 位置 F:\Develop\Com.Zfrong.Arch\Common\Data\NH\test2.cs:行号 113
       在 NH.Test.test2.Main(String[] args) 位置 F:\Develop\Com.Zfrong.Arch\Common\Data\NH\test2.cs:行号 107
  InnerException: System.MissingMethodException
       Message=没有为该对象定义无参数的构造函数。
       Source=mscorlib
       StackTrace:
            在 System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
            在 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
            在 System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
            在 System.Activator.CreateInstance(Type type, Boolean nonPublic)
            在 System.Activator.CreateInstance(Type type)
            在 NHibernate.Bytecode.ActivatorObjectsFactory.CreateInstance(Type type)
            在 NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary`2 properties)

       InnerException:

Solve
Program
     

#region
            configuration.Cache(c => //(Cache)
            {
                c.UseQueryCache = DefaultUseQueryCache;
                c.UseMinimalPuts = true;
                c.RegionsPrefix = "Cache";
                c.DefaultExpiration = 60;//秒
                if (DefaultUseSecondLevelCache)
                {
                     c.Provider<HashtableCacheProvider>();//
                     // c.QueryCache<StandardQueryCache>();//   is  error 

                    //is OK

                      configuration.SetProperty(Environment.UseSecondLevelCache, "true");
                     configuration.SetProperty(Environment.QueryCacheFactory, typeof(StandardQueryCacheFactory).FullName);

                }

            });
            #endregion


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值