我正在尝试使用Windows Azure缓存为NHibernate 3.2设置二级缓存。到目前为止,使用https://www.windowsazure.com/en-us/develop/net/how-to-guides/cache/,我在web.config中设置了Azure缓存:
<section name="dataCacheClients" type="Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core" allowLocation="true" allowDefinition="Everywhere" />
...
<dataCacheClients>
<dataCacheClient name="default">
<autoDiscover isEnabled="true" identifier="App.UI" />
</dataCacheClient>
然后我从http://sourceforge.net/projects/nhcontrib/files/NHibernate.Caches/3.2.0.GA_for_NH3.2.0GA/
下载并添加了Velocity缓存提供程序DLL最后,我的hibernate.cfg.xml是:
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
...
<property name="cache.use_second_level_cache">true</property>
<property name="cache.use_query_cache" >true</property>
<property name="cache.provider_class">NHibernate.Caches.Velocity.VelocityProvider, NHibernate.Caches.Velocity</property>
</session-factory>
</hibernate-configuration>
更新 解决了,依赖问题,我现在得到一个错误 {“ErrorCode:\”dcacheClient \“标记未在应用程序配置文件中指定。在配置文件中指定有效标记。”}
谢谢