views:

31

answers:

1

Hi, I tried to use a cache configuration like this post from a website:

<configSections>
    <section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" requirePermission="false"/>
    <section name="syscache" type="NHibernate.Caches.SysCache.SysCacheSectionHandler, NHibernate.Caches.SysCache" requirePermission="false" />
</configSections>

<!-- NHibernate -->
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
        <!-- dialect, connection string, etc... -->

        <property name="cache.provider_class">NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache</property>
        <property name="cache.use_second_level_cache">true</property>
    </session-factory>
</hibernate-configuration>

<!-- Caching -->
<syscache>
    <cache region="LongTerm" expiration="3600" priority="5" />
    <cache region="ShortTerm" expiration="900" priority="3" />
</syscache>

<-- ... -->

It seems the schema file for my hibernate.cfg.xml is not liking this, though. Am I supposed to use cache.region_prefix or something? I want to use Syscache, btw.

+2  A: 

Neither the configSections nor the syscache sections go in your hibernate.cfg.xml file.

They go in the App.config/Web.config file.

Diego Mijelshon
Yeah, so I've found out! Can I use both of these or just one or the other?My partner started this app, I'm not sure why he didn't choose the App.config file route
IsaacB
You can use both (hibernate.cfg.xml just for NHibernate core stuff, and app.config for the rest)
Diego Mijelshon
Thanks! I shall look into this.
IsaacB