forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathISessionFactoryImplementor.cs
188 lines (157 loc) · 6.5 KB
/
ISessionFactoryImplementor.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
using System.Collections.Generic;
using System.Data;
using Iesi.Collections.Generic;
using NHibernate.Cache;
using NHibernate.Cfg;
using NHibernate.Connection;
using NHibernate.Context;
using NHibernate.Dialect.Function;
using NHibernate.Engine.Query;
using NHibernate.Exceptions;
using NHibernate.Id;
using NHibernate.Persister.Collection;
using NHibernate.Persister.Entity;
using NHibernate.Proxy;
using NHibernate.Stat;
using NHibernate.Transaction;
using NHibernate.Type;
namespace NHibernate.Engine
{
/// <summary>
/// Defines the internal contract between the <c>ISessionFactory</c> and other parts of NHibernate
/// such as implementors of <c>IType</c>.
/// </summary>
public interface ISessionFactoryImplementor : IMapping, ISessionFactory
{
/// <summary>
/// Get the SQL <see cref="NHibernate.Dialect.Dialect"/>.
/// </summary>
Dialect.Dialect Dialect { get; }
IInterceptor Interceptor { get; }
QueryPlanCache QueryPlanCache { get; }
/// <summary>
/// Get the <see cref="IConnectionProvider" /> used.
/// </summary>
IConnectionProvider ConnectionProvider { get; }
ITransactionFactory TransactionFactory { get; }
/// <summary> The cache of table update timestamps</summary>
UpdateTimestampsCache UpdateTimestampsCache { get; }
/// <summary> Statistics SPI</summary>
IStatisticsImplementor StatisticsImplementor { get; }
/// <summary> Retrieves the SQLExceptionConverter in effect for this SessionFactory. </summary>
/// <returns> The SQLExceptionConverter for this SessionFactory. </returns>
ISQLExceptionConverter SQLExceptionConverter { get; }
Settings Settings { get; }
IEntityNotFoundDelegate EntityNotFoundDelegate { get; }
SQLFunctionRegistry SQLFunctionRegistry { get; }
IDictionary<string, ICache> GetAllSecondLevelCacheRegions();
/// <summary>
/// Get the persister for the named entity
/// </summary>
/// <param name="entityName">The name of the entity that is persisted.</param>
/// <returns>The <see cref="IEntityPersister"/> for the entity.</returns>
/// <exception cref="MappingException">If no <see cref="IEntityPersister"/> can be found.</exception>
IEntityPersister GetEntityPersister(string entityName);
/// <summary>
/// Get the persister object for a collection role
/// </summary>
/// <param name="role"></param>
/// <returns></returns>
ICollectionPersister GetCollectionPersister(string role);
/// <summary>
/// Get the return types of a query
/// </summary>
/// <param name="queryString"></param>
/// <returns></returns>
IType[] GetReturnTypes(string queryString);
/// <summary> Get the return aliases of a query</summary>
string[] GetReturnAliases(string queryString);
/// <summary>
/// Get the names of all persistent classes that implement/extend the given interface/class
/// </summary>
/// <param name="entityOrClassName">The entity-name, the class name or full name, the imported class name.</param>
/// <returns>All implementors class names.</returns>
string[] GetImplementors(string entityOrClassName);
/// <summary>
/// Get a class name, using query language imports
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
string GetImportedClassName(string name);
/// <summary>
/// Get the default query cache
/// </summary>
IQueryCache QueryCache { get; }
/// <summary>
/// Get a particular named query cache, or the default cache
/// </summary>
/// <param name="regionName">the name of the cache region, or null for the default
/// query cache</param>
/// <returns>the existing cache, or a newly created cache if none by that
/// region name</returns>
IQueryCache GetQueryCache(string regionName);
/// <summary>
/// Gets the <c>hql</c> query identified by the <c>name</c>.
/// </summary>
/// <param name="queryName">The name of that identifies the query.</param>
/// <returns>
/// A <c>hql</c> query or <see langword="null" /> if the named
/// query does not exist.
/// </returns>
NamedQueryDefinition GetNamedQuery(string queryName);
NamedSQLQueryDefinition GetNamedSQLQuery(string queryName);
ResultSetMappingDefinition GetResultSetMapping(string resultSetRef);
/// <summary>
/// Get the identifier generator for the hierarchy
/// </summary>
IIdentifierGenerator GetIdentifierGenerator(string rootEntityName);
/// <summary> Get a named second-level cache region</summary>
ICache GetSecondLevelCacheRegion(string regionName);
/// <summary>
/// Open a session conforming to the given parameters. Used mainly
/// for current session processing.
/// </summary>
/// <param name="connection">The external ado.net connection to use, if one (i.e., optional).</param>
/// <param name="flushBeforeCompletionEnabled">
/// Should the session be auto-flushed
/// prior to transaction completion?
/// </param>
/// <param name="autoCloseSessionEnabled">
/// Should the session be auto-closed after
/// transaction completion?
/// </param>
/// <param name="connectionReleaseMode">The release mode for managed jdbc connections.</param>
/// <returns>An appropriate session.</returns>
ISession OpenSession(IDbConnection connection, bool flushBeforeCompletionEnabled, bool autoCloseSessionEnabled,
ConnectionReleaseMode connectionReleaseMode);
/// <summary>
/// Retrieves a set of all the collection roles in which the given entity
/// is a participant, as either an index or an element.
/// </summary>
/// <param name="entityName">The entity name for which to get the collection roles.</param>
/// <returns>
/// Set of all the collection roles in which the given entityName participates.
/// </returns>
ISet<string> GetCollectionRolesByEntityParticipant(string entityName);
#region NHibernate specific
/// <summary>
/// Gets the ICurrentSessionContext instance attached to this session factory.
/// </summary>
ICurrentSessionContext CurrentSessionContext { get; } // TODO NH : Remove
/// <summary>
/// Get the persister for the named entity
/// </summary>
/// <param name="entityName">The name of the entity that is persisted.</param>
/// <returns>
/// The <see cref="IEntityPersister"/> for the entity or <see langword="null"/> is the name was not found.
/// </returns>
IEntityPersister TryGetEntityPersister(string entityName);
/// <summary>
/// Get the entity-name for a given mapped class.
/// </summary>
/// <param name="implementor">the mapped class</param>
/// <returns>the enntity name where available or null</returns>
string TryGetGuessEntityName(System.Type implementor);
#endregion
}
}