Skip to content

Commit 91ad2ee

Browse files
Add missing options to QueryOver
Fix #2270
1 parent d8931ac commit 91ad2ee

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

src/NHibernate/QueryOverExtensions.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
namespace NHibernate
2+
{
3+
// 6.0 TODO: merge into IQueryOver<TRoot>
4+
public static class QueryOverExtensions
5+
{
6+
/// <summary>
7+
/// Set a timeout for the underlying ADO.NET query.
8+
/// </summary>
9+
/// <param name="queryOver">The query on which to set the timeout.</param>
10+
/// <param name="timeout">The timeout in seconds.</param>
11+
/// <returns><see langword="this" /> (for method chaining).</returns>
12+
public static IQueryOver<TRoot> SetTimeout<TRoot>(this IQueryOver<TRoot> queryOver, int timeout)
13+
{
14+
queryOver.RootCriteria.SetTimeout(timeout);
15+
return queryOver;
16+
}
17+
18+
/// <summary>
19+
/// Set a fetch size for the underlying ADO query.
20+
/// </summary>
21+
/// <param name="queryOver">The query on which to set the timeout.</param>
22+
/// <param name="fetchSize">The fetch size.</param>
23+
/// <returns><see langword="this" /> (for method chaining).</returns>
24+
public static IQueryOver<TRoot> SetFetchSize<TRoot>(this IQueryOver<TRoot> queryOver, int fetchSize)
25+
{
26+
queryOver.RootCriteria.SetFetchSize(fetchSize);
27+
return queryOver;
28+
}
29+
30+
/// <summary>
31+
/// Add a comment to the generated SQL.
32+
/// </summary>
33+
/// <param name="queryOver">The query on which to set the timeout.</param>
34+
/// <param name="comment">A human-readable string.</param>
35+
/// <returns><see langword="this" /> (for method chaining).</returns>
36+
public static IQueryOver<TRoot> SetComment<TRoot>(this IQueryOver<TRoot> queryOver, string comment)
37+
{
38+
queryOver.RootCriteria.SetComment(comment);
39+
return queryOver;
40+
}
41+
}
42+
}

0 commit comments

Comments
 (0)