forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQueryBatchItem.cs
41 lines (35 loc) · 1 KB
/
QueryBatchItem.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Linq;
using NHibernate.Engine;
using NHibernate.Impl;
namespace NHibernate.Multi
{
public partial class QueryBatchItem<TResult> : QueryBatchItemBase<TResult>
{
protected readonly AbstractQueryImpl Query;
public QueryBatchItem(IQuery query)
{
Query = (AbstractQueryImpl) query ?? throw new ArgumentNullException(nameof(query));
}
protected override List<QueryInfo> GetQueryInformation(ISessionImplementor session)
{
Query.VerifyParameters();
QueryParameters queryParameters = Query.GetQueryParameters();
queryParameters.ValidateParameters();
return
Query
.GetTranslators(Session, queryParameters)
.Select(t => new QueryInfo(queryParameters, t.Loader, new HashSet<string>(t.QuerySpaces), session))
.ToList();
}
protected override IList<TResult> GetResultsNonBatched()
{
return Query.List<TResult>();
}
protected override List<TResult> DoGetResults()
{
return GetTypedResults<TResult>();
}
}
}