File tree Expand file tree Collapse file tree 2 files changed +85
-5
lines changed
NHibernate.Test/Criteria/Lambda Expand file tree Collapse file tree 2 files changed +85
-5
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
- using System . Collections ;
3
-
4
2
using NUnit . Framework ;
5
-
6
3
using NHibernate . Criterion ;
7
4
using NHibernate . SqlCommand ;
8
5
using NHibernate . Transform ;
9
- using NHibernate . Type ;
10
- using NHibernate . Util ;
11
6
12
7
namespace NHibernate . Test . Criteria . Lambda
13
8
{
@@ -928,6 +923,48 @@ public void Readonly()
928
923
AssertCriteriaAreEqual ( expected , actual ) ;
929
924
}
930
925
926
+ [ Test ]
927
+ public void SetTimeout ( )
928
+ {
929
+ var expected =
930
+ CreateTestCriteria ( typeof ( Person ) )
931
+ . SetTimeout ( 3 ) ;
932
+
933
+ var actual =
934
+ CreateTestQueryOver < Person > ( )
935
+ . SetTimeout ( 3 ) ;
936
+
937
+ AssertCriteriaAreEqual ( expected , actual ) ;
938
+ }
939
+
940
+ [ Test ]
941
+ public void SetFetchSize ( )
942
+ {
943
+ var expected =
944
+ CreateTestCriteria ( typeof ( Person ) )
945
+ . SetFetchSize ( 3 ) ;
946
+
947
+ var actual =
948
+ CreateTestQueryOver < Person > ( )
949
+ . SetFetchSize ( 3 ) ;
950
+
951
+ AssertCriteriaAreEqual ( expected , actual ) ;
952
+ }
953
+
954
+ [ Test ]
955
+ public void SetComment ( )
956
+ {
957
+ var expected =
958
+ CreateTestCriteria ( typeof ( Person ) )
959
+ . SetComment ( "blah" ) ;
960
+
961
+ var actual =
962
+ CreateTestQueryOver < Person > ( )
963
+ . SetComment ( "blah" ) ;
964
+
965
+ AssertCriteriaAreEqual ( expected , actual ) ;
966
+ }
967
+
931
968
[ Test ]
932
969
public void DetachedQueryOver ( )
933
970
{
Original file line number Diff line number Diff line change
1
+ namespace NHibernate
2
+ {
3
+ // 6.0 TODO: consider moving other criteria delegated methods to extension methods.
4
+ // It may allow better return typing for chaining, and it is slightly less code.
5
+ public static class QueryOverExtensions
6
+ {
7
+ /// <summary>
8
+ /// Set a timeout for the underlying ADO.NET query.
9
+ /// </summary>
10
+ /// <param name="queryOver">The query on which to set the timeout.</param>
11
+ /// <param name="timeout">The timeout in seconds.</param>
12
+ /// <returns><see langword="this" /> (for method chaining).</returns>
13
+ public static TQueryOver SetTimeout < TQueryOver > ( this TQueryOver queryOver , int timeout ) where TQueryOver : IQueryOver
14
+ {
15
+ queryOver . RootCriteria . SetTimeout ( timeout ) ;
16
+ return queryOver ;
17
+ }
18
+
19
+ /// <summary>
20
+ /// Set a fetch size for the underlying ADO query.
21
+ /// </summary>
22
+ /// <param name="queryOver">The query on which to set the timeout.</param>
23
+ /// <param name="fetchSize">The fetch size.</param>
24
+ /// <returns><see langword="this" /> (for method chaining).</returns>
25
+ public static TQueryOver SetFetchSize < TQueryOver > ( this TQueryOver queryOver , int fetchSize ) where TQueryOver : IQueryOver
26
+ {
27
+ queryOver . RootCriteria . SetFetchSize ( fetchSize ) ;
28
+ return queryOver ;
29
+ }
30
+
31
+ /// <summary>
32
+ /// Add a comment to the generated SQL.
33
+ /// </summary>
34
+ /// <param name="queryOver">The query on which to set the timeout.</param>
35
+ /// <param name="comment">A human-readable string.</param>
36
+ /// <returns><see langword="this" /> (for method chaining).</returns>
37
+ public static TQueryOver SetComment < TQueryOver > ( this TQueryOver queryOver , string comment ) where TQueryOver : IQueryOver
38
+ {
39
+ queryOver . RootCriteria . SetComment ( comment ) ;
40
+ return queryOver ;
41
+ }
42
+ }
43
+ }
You can’t perform that action at this time.
0 commit comments