Created
January 28, 2010 09:13
-
-
Save JeremySkinner/288570 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> | |
| <session-factory name="MyApp"> | |
| <!-- ommitted connection configuration --> | |
| <!-- Both cache and second level cache enabled --> | |
| <property name="cache.provider_class">NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache</property> | |
| <property name="cache.use_second_level_cache">true</property> | |
| <property name="cache.use_query_cache">true</property> | |
| <mapping assembly="MyApp.Model"/> | |
| </session-factory> | |
| </hibernate-configuration> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Query is marked as cacheable, but the query cache is never used. | |
| var rooms = session.CreateQuery("from Room order by Name") | |
| .SetCacheable(true) | |
| .List<Room>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="MyApp.Model" namespace="MyApp.Model"> | |
| <class name="Room" table="Rooms" mutable="false"> | |
| <!-- entity is set as cacheable --> | |
| <cache usage="read-only" /> | |
| <id name="Id" column="Room_Id"> | |
| <generator class="identity"/> | |
| </id> | |
| <property name="Name" column="Room_Name"/> | |
| <property name="UseForRegistration" column="Use_For_Registration" /> | |
| <property name="Bookable" /> | |
| <property name="NotAvailableToOthers" column="Not_Available_To_Others" /> | |
| </class> | |
| </hibernate-mapping> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment