forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBasicCollectionLoader.cs
46 lines (38 loc) · 2.01 KB
/
BasicCollectionLoader.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
42
43
44
45
46
using System.Collections.Generic;
using NHibernate.Engine;
using NHibernate.Persister.Collection;
using NHibernate.SqlCommand;
namespace NHibernate.Loader.Collection
{
/// <summary>
/// Loads a collection of values or a many-to-many association.
/// </summary>
/// <remarks>
/// The collection persister must implement <seealso cref="IQueryableCollection"/>. For
/// other collections, create a customized subclass of <seealso cref="Loader"/>
/// </remarks>
/// <seealso cref="OneToManyLoader"/>
public class BasicCollectionLoader : CollectionLoader
{
private static readonly INHibernateLogger log = NHibernateLogger.For(typeof (BasicCollectionLoader));
public BasicCollectionLoader(IQueryableCollection collectionPersister, ISessionFactoryImplementor session,
IDictionary<string, IFilter> enabledFilters)
: this(collectionPersister, 1, session, enabledFilters) {}
public BasicCollectionLoader(IQueryableCollection collectionPersister, int batchSize,
ISessionFactoryImplementor factory, IDictionary<string, IFilter> enabledFilters)
: this(collectionPersister, batchSize, null, factory, enabledFilters) {}
protected BasicCollectionLoader(IQueryableCollection collectionPersister, int batchSize, SqlString subquery,
ISessionFactoryImplementor factory, IDictionary<string, IFilter> enabledFilters)
: base(collectionPersister, factory, enabledFilters)
{
InitializeFromWalker(collectionPersister, subquery, batchSize, enabledFilters, factory);
}
protected virtual void InitializeFromWalker(IQueryableCollection collectionPersister, SqlString subquery, int batchSize, IDictionary<string, IFilter> enabledFilters, ISessionFactoryImplementor factory)
{
JoinWalker walker = new BasicCollectionJoinWalker(collectionPersister, batchSize, subquery, factory, enabledFilters);
InitFromWalker(walker);
PostInstantiate();
log.Debug("Static select for collection {0}: {1}", collectionPersister.Role, SqlString);
}
}
}