From: <ric...@us...> - 2009-07-28 20:09:53
|
Revision: 4667 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4667&view=rev Author: ricbrown Date: 2009-07-28 20:09:38 +0000 (Tue, 28 Jul 2009) Log Message: ----------- Added CacheMode and CacheRegion to IQueryOver. Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs trunk/nhibernate/src/NHibernate/IQueryOver.cs trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs Modified: trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs 2009-07-28 19:40:32 UTC (rev 4666) +++ trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs 2009-07-28 20:09:38 UTC (rev 4667) @@ -111,6 +111,18 @@ return this; } + public IQueryOver<T> CacheMode(CacheMode cacheMode) + { + _criteria.SetCacheMode(cacheMode); + return this; + } + + public IQueryOver<T> CacheRegion(string cacheRegion) + { + _criteria.SetCacheRegion(cacheRegion); + return this; + } + public QueryOver<U> JoinQueryOver<U>(Expression<Func<T, U>> path) { return new QueryOver<U>(_impl, @@ -300,6 +312,12 @@ IQueryOver<T> IQueryOver<T>.Cacheable() { return Cacheable(); } + IQueryOver<T> IQueryOver<T>.CacheMode(CacheMode cacheMode) + { return CacheMode(cacheMode); } + + IQueryOver<T> IQueryOver<T>.CacheRegion(string cacheRegion) + { return CacheRegion(cacheRegion); } + IQueryOver<U> IQueryOver<T>.JoinQueryOver<U>(Expression<Func<T, U>> path) { return JoinQueryOver(path); } Modified: trunk/nhibernate/src/NHibernate/IQueryOver.cs =================================================================== --- trunk/nhibernate/src/NHibernate/IQueryOver.cs 2009-07-28 19:40:32 UTC (rev 4666) +++ trunk/nhibernate/src/NHibernate/IQueryOver.cs 2009-07-28 20:09:38 UTC (rev 4667) @@ -113,7 +113,19 @@ /// </summary> IQueryOver<T> Cacheable(); + /// <summary> Override the cache mode for this particular query. </summary> + /// <param name="cacheMode">The cache mode to use. </param> + /// <returns> this (for method chaining) </returns> + IQueryOver<T> CacheMode(CacheMode cacheMode); + /// <summary> + /// Set the name of the cache region. + /// </summary> + /// <param name="cacheRegion">the name of a query cache region, or <see langword="null" /> + /// for the default query cache</param> + IQueryOver<T> CacheRegion(string cacheRegion); + + /// <summary> /// Creates a new NHibernate.ICriteria<T>, "rooted" at the associated entity /// </summary> /// <typeparam name="U">Type of sub-criteria</typeparam> Modified: trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs 2009-07-28 19:40:32 UTC (rev 4666) +++ trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs 2009-07-28 20:09:38 UTC (rev 4667) @@ -302,11 +302,15 @@ { ICriteria expected = CreateTestCriteria(typeof(Person)) - .SetCacheable(true); + .SetCacheable(true) + .SetCacheMode(CacheMode.Put) + .SetCacheRegion("my cache region"); IQueryOver<Person> actual = CreateTestQueryOver<Person>() - .Cacheable(); + .Cacheable() + .CacheMode(CacheMode.Put) + .CacheRegion("my cache region"); AssertCriteriaAreEqual(expected, actual); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |