Skip to content

Commit 752c573

Browse files
fixup!  Implement universal query batch
Document API meant to be public facing
1 parent 47939fc commit 752c573

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

src/NHibernate/ISession.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,14 @@ public static ISharedStatelessSessionBuilder StatelessSessionWithOptions(this IS
2929
return impl.StatelessSessionWithOptions();
3030
}
3131

32-
public static IQueryBatch CreateQueryBatch(this ISession implementor)
32+
/// <summary>
33+
/// Creates a <see cref="IQueryBatch"/> for the session.
34+
/// </summary>
35+
/// <param name="session">The session</param>
36+
/// <returns>A query batch.</returns>
37+
public static IQueryBatch CreateQueryBatch(this ISession session)
3338
{
34-
return ReflectHelper.CastOrThrow<AbstractSessionImpl>(implementor, "query batch").CreateQueryBatch();
39+
return ReflectHelper.CastOrThrow<AbstractSessionImpl>(session, "query batch").CreateQueryBatch();
3540
}
3641
}
3742

src/NHibernate/IStatelessSession.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,14 @@ namespace NHibernate
1313
// 6.0 TODO: Convert to interface methods
1414
public static class StatelessSessionExtensions
1515
{
16-
public static IQueryBatch CreateQueryBatch(this IStatelessSession implementor)
16+
/// <summary>
17+
/// Creates a <see cref="IQueryBatch"/> for the session.
18+
/// </summary>
19+
/// <param name="session">The session</param>
20+
/// <returns>A query batch.</returns>
21+
public static IQueryBatch CreateQueryBatch(this IStatelessSession session)
1722
{
18-
return ReflectHelper.CastOrThrow<AbstractSessionImpl>(implementor, "query batch").CreateQueryBatch();
23+
return ReflectHelper.CastOrThrow<AbstractSessionImpl>(session, "query batch").CreateQueryBatch();
1924
}
2025
}
2126

src/NHibernate/Multi/QueryBatchExtensions.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public static partial class QueryBatchExtensions
1818
/// <param name="batch">The batch.</param>
1919
/// <param name="query">The query.</param>
2020
/// <param name="afterLoad">Callback to execute when query is loaded. Loaded results are provided as action parameter.</param>
21+
/// <typeparam name="TResult">The type of the query result elements.</typeparam>
2122
/// <exception cref="InvalidOperationException">Thrown if the batch has already been executed.</exception>
2223
/// <exception cref="ArgumentNullException">Thrown if <paramref name="query"/> is <see langword="null"/>.</exception>
2324
/// <returns>The batch instance for method chain.</returns>
@@ -32,6 +33,7 @@ public static IQueryBatch Add<TResult>(this IQueryBatch batch, IQueryOver query,
3233
/// <param name="batch">The batch.</param>
3334
/// <param name="key">A key for retrieval of the query result.</param>
3435
/// <param name="query">The query.</param>
36+
/// <typeparam name="TResult">The type of the query result elements.</typeparam>
3537
/// <exception cref="InvalidOperationException">Thrown if the batch has already been executed.</exception>
3638
/// <exception cref="ArgumentNullException">Thrown if <paramref name="query"/> is <see langword="null"/>.</exception>
3739
/// <returns>The batch instance for method chain.</returns>
@@ -49,6 +51,7 @@ public static IQueryBatch Add<TResult>(this IQueryBatch batch, string key, IQuer
4951
/// <param name="batch">The batch.</param>
5052
/// <param name="query">The query.</param>
5153
/// <param name="afterLoad">Callback to execute when query is loaded. Loaded results are provided as action parameter.</param>
54+
/// <typeparam name="TResult">The type of the query result elements.</typeparam>
5255
/// <exception cref="InvalidOperationException">Thrown if the batch has already been executed.</exception>
5356
/// <exception cref="ArgumentNullException">Thrown if <paramref name="query"/> is <see langword="null"/>.</exception>
5457
/// <returns>The batch instance for method chain.</returns>
@@ -63,6 +66,7 @@ public static IQueryBatch Add<TResult>(this IQueryBatch batch, IQueryOver<TResul
6366
/// <param name="batch">The batch.</param>
6467
/// <param name="key">A key for retrieval of the query result.</param>
6568
/// <param name="query">The query.</param>
69+
/// <typeparam name="TResult">The type of the query result elements.</typeparam>
6670
/// <exception cref="InvalidOperationException">Thrown if the batch has already been executed.</exception>
6771
/// <exception cref="ArgumentNullException">Thrown if <paramref name="query"/> is <see langword="null"/>.</exception>
6872
/// <returns>The batch instance for method chain.</returns>
@@ -78,6 +82,7 @@ public static IQueryBatch Add<TResult>(this IQueryBatch batch, string key, IQuer
7882
/// <param name="batch">The batch.</param>
7983
/// <param name="query">The query.</param>
8084
/// <param name="afterLoad">Callback to execute when query is loaded. Loaded results are provided as action parameter.</param>
85+
/// <typeparam name="TResult">The type of the query result elements.</typeparam>
8186
/// <exception cref="InvalidOperationException">Thrown if the batch has already been executed.</exception>
8287
/// <exception cref="ArgumentNullException">Thrown if <paramref name="query"/> is <see langword="null"/>.</exception>
8388
/// <returns>The batch instance for method chain.</returns>
@@ -92,6 +97,7 @@ public static IQueryBatch Add<TResult>(this IQueryBatch batch, ICriteria query,
9297
/// <param name="batch">The batch.</param>
9398
/// <param name="key">A key for retrieval of the query result.</param>
9499
/// <param name="query">The query.</param>
100+
/// <typeparam name="TResult">The type of the query result elements.</typeparam>
95101
/// <exception cref="InvalidOperationException">Thrown if the batch has already been executed.</exception>
96102
/// <exception cref="ArgumentNullException">Thrown if <paramref name="query"/> is <see langword="null"/>.</exception>
97103
/// <returns>The batch instance for method chain.</returns>
@@ -107,6 +113,7 @@ public static IQueryBatch Add<TResult>(this IQueryBatch batch, string key, ICrit
107113
/// <param name="batch">The batch.</param>
108114
/// <param name="query">The query.</param>
109115
/// <param name="afterLoad">Callback to execute when query is loaded. Loaded results are provided as action parameter.</param>
116+
/// <typeparam name="TResult">The type of the query result elements.</typeparam>
110117
/// <exception cref="InvalidOperationException">Thrown if the batch has already been executed.</exception>
111118
/// <exception cref="ArgumentNullException">Thrown if <paramref name="query"/> is <see langword="null"/>.</exception>
112119
/// <returns>The batch instance for method chain.</returns>
@@ -121,6 +128,7 @@ public static IQueryBatch Add<TResult>(this IQueryBatch batch, DetachedCriteria
121128
/// <param name="batch">The batch.</param>
122129
/// <param name="key">A key for retrieval of the query result.</param>
123130
/// <param name="query">The query.</param>
131+
/// <typeparam name="TResult">The type of the query result elements.</typeparam>
124132
/// <exception cref="InvalidOperationException">Thrown if the batch has already been executed.</exception>
125133
/// <exception cref="ArgumentNullException">Thrown if <paramref name="query"/> is <see langword="null"/>.</exception>
126134
/// <returns>The batch instance for method chain.</returns>
@@ -136,6 +144,7 @@ public static IQueryBatch Add<TResult>(this IQueryBatch batch, string key, Detac
136144
/// <param name="batch">The batch.</param>
137145
/// <param name="query">The query.</param>
138146
/// <param name="afterLoad">Callback to execute when query is loaded. Loaded results are provided as action parameter.</param>
147+
/// <typeparam name="TResult">The type of the query result elements.</typeparam>
139148
/// <exception cref="InvalidOperationException">Thrown if the batch has already been executed.</exception>
140149
/// <exception cref="ArgumentNullException">Thrown if <paramref name="query"/> is <see langword="null"/>.</exception>
141150
/// <returns>The batch instance for method chain.</returns>
@@ -150,6 +159,7 @@ public static IQueryBatch Add<TResult>(this IQueryBatch batch, IQuery query, Act
150159
/// <param name="batch">The batch.</param>
151160
/// <param name="key">A key for retrieval of the query result.</param>
152161
/// <param name="query">The query.</param>
162+
/// <typeparam name="TResult">The type of the query result elements.</typeparam>
153163
/// <exception cref="InvalidOperationException">Thrown if the batch has already been executed.</exception>
154164
/// <exception cref="ArgumentNullException">Thrown if <paramref name="query"/> is <see langword="null"/>.</exception>
155165
/// <returns>The batch instance for method chain.</returns>
@@ -165,6 +175,7 @@ public static IQueryBatch Add<TResult>(this IQueryBatch batch, string key, IQuer
165175
/// <param name="batch">The batch.</param>
166176
/// <param name="query">The query.</param>
167177
/// <param name="afterLoad">Callback to execute when query is loaded. Loaded results are provided as action parameter.</param>
178+
/// <typeparam name="TResult">The type of the query result elements.</typeparam>
168179
/// <exception cref="InvalidOperationException">Thrown if the batch has already been executed.</exception>
169180
/// <exception cref="ArgumentNullException">Thrown if <paramref name="query"/> is <see langword="null"/>.</exception>
170181
/// <returns>The batch instance for method chain.</returns>
@@ -179,6 +190,7 @@ public static IQueryBatch Add<TResult>(this IQueryBatch batch, IQueryable<TResul
179190
/// <param name="batch">The batch.</param>
180191
/// <param name="key">A key for retrieval of the query result.</param>
181192
/// <param name="query">The query.</param>
193+
/// <typeparam name="TResult">The type of the query result elements.</typeparam>
182194
/// <exception cref="InvalidOperationException">Thrown if the batch has already been executed.</exception>
183195
/// <exception cref="ArgumentNullException">Thrown if <paramref name="query"/> is <see langword="null"/>.</exception>
184196
/// <returns>The batch instance for method chain.</returns>
@@ -195,6 +207,8 @@ public static IQueryBatch Add<TResult>(this IQueryBatch batch, string key, IQuer
195207
/// <param name="query">The query.</param>
196208
/// <param name="selector">An aggregation function to apply to <paramref name="query"/>.</param>
197209
/// <param name="afterLoad">Callback to execute when query is loaded. Loaded results are provided as action parameter.</param>
210+
/// <typeparam name="TSource">The type of the query elements before aggregation.</typeparam>
211+
/// <typeparam name="TResult">The type resulting of the query result aggregation.</typeparam>
198212
/// <exception cref="InvalidOperationException">Thrown if the batch has already been executed.</exception>
199213
/// <exception cref="ArgumentNullException">Thrown if <paramref name="query"/> is <see langword="null"/>.</exception>
200214
/// <returns>The batch instance for method chain.</returns>
@@ -210,6 +224,8 @@ public static IQueryBatch Add<TSource, TResult>(this IQueryBatch batch, IQueryab
210224
/// <param name="key">A key for retrieval of the query result.</param>
211225
/// <param name="query">The query.</param>
212226
/// <param name="selector">An aggregation function to apply to <paramref name="query"/>.</param>
227+
/// <typeparam name="TSource">The type of the query elements before aggregation.</typeparam>
228+
/// <typeparam name="TResult">The type resulting of the query result aggregation.</typeparam>
213229
/// <exception cref="InvalidOperationException">Thrown if the batch has already been executed.</exception>
214230
/// <exception cref="ArgumentNullException">Thrown if <paramref name="query"/> is <see langword="null"/>.</exception>
215231
/// <returns>The batch instance for method chain.</returns>

0 commit comments

Comments
 (0)