|
From: <ric...@us...> - 2009-07-28 19:40:45
|
Revision: 4666
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4666&view=rev
Author: ricbrown
Date: 2009-07-28 19:40:32 +0000 (Tue, 28 Jul 2009)
Log Message:
-----------
Added Cachable() 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-27 22:28:49 UTC (rev 4665)
+++ trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs 2009-07-28 19:40:32 UTC (rev 4666)
@@ -105,6 +105,12 @@
return this;
}
+ public IQueryOver<T> Cacheable()
+ {
+ _criteria.SetCacheable(true);
+ return this;
+ }
+
public QueryOver<U> JoinQueryOver<U>(Expression<Func<T, U>> path)
{
return new QueryOver<U>(_impl,
@@ -291,6 +297,9 @@
IQueryOver<T> IQueryOver<T>.Take(int maxResults)
{ return Take(maxResults); }
+ IQueryOver<T> IQueryOver<T>.Cacheable()
+ { return Cacheable(); }
+
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-27 22:28:49 UTC (rev 4665)
+++ trunk/nhibernate/src/NHibernate/IQueryOver.cs 2009-07-28 19:40:32 UTC (rev 4666)
@@ -109,6 +109,11 @@
IQueryOver<T> Take(int maxResults);
/// <summary>
+ /// Enable caching of this query result set
+ /// </summary>
+ IQueryOver<T> Cacheable();
+
+ /// <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-27 22:28:49 UTC (rev 4665)
+++ trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs 2009-07-28 19:40:32 UTC (rev 4666)
@@ -297,6 +297,20 @@
AssertCriteriaAreEqual(expected, actual);
}
+ [Test]
+ public void Cachable()
+ {
+ ICriteria expected =
+ CreateTestCriteria(typeof(Person))
+ .SetCacheable(true);
+
+ IQueryOver<Person> actual =
+ CreateTestQueryOver<Person>()
+ .Cacheable();
+
+ AssertCriteriaAreEqual(expected, actual);
+ }
+
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|