2

我正在尝试使用 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> 

UPDATE 解决了依赖问题,我现在得到一个错误 {"ErrorCode:\"dcacheClient\" tag not specified in the application configuration file. Specify valid tag in configuration file."}

谢谢

4

0 回答 0