forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathISessionFactory.cs
128 lines (113 loc) · 4.45 KB
/
ISessionFactory.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
using System.Collections;
using System.Data;
using NHibernate.Metadata;
namespace NHibernate
{
/// <summary>
/// Creates <c>ISession</c>s.
/// </summary>
/// <remarks>
/// <para>
/// Usually an application has a single <c>SessionFactory</c>. Threads servicing client requests
/// obtain <c>ISession</c>s from the factory. Implementors must be threadsafe.
/// </para>
/// <para>
/// <c>ISessionFactory</c>s are immutable. The behaviour of a <c>SessionFactory</c>
/// is controlled by properties supplied at configuration time.
/// These properties are defined on <c>Environment</c>
/// </para>
/// </remarks>
public interface ISessionFactory
{
/// <summary>
/// Open a <c>ISession</c> on the given connection
/// </summary>
/// <param name="conn">A connection provided by the application</param>
/// <returns>A session</returns>
ISession OpenSession( IDbConnection conn );
/// <summary>
/// Create database connection and open a <c>ISession</c> on it, specifying an interceptor
/// </summary>
/// <param name="interceptor">A session-scoped interceptor</param>
/// <returns>A session</returns>
ISession OpenSession( IInterceptor interceptor );
/// <summary>
/// Open a <c>ISession</c> on the given connection, specifying an interceptor
/// </summary>
/// <param name="conn">A connection provided by the application</param>
/// <param name="interceptor">A session-scoped interceptor</param>
/// <returns>A session</returns>
ISession OpenSession( IDbConnection conn, IInterceptor interceptor );
/// <summary>
/// Create a database connection and open a <c>ISession</c> on it
/// </summary>
/// <returns></returns>
ISession OpenSession();
/// <summary>
/// Create a new databinder.
/// </summary>
/// <returns></returns>
IDatabinder OpenDatabinder();
/// <summary>
/// Get the <c>ClassMetadata</c> associated with the given entity class
/// </summary>
/// <param name="persistentType"></param>
/// <returns></returns>
IClassMetadata GetClassMetadata( System.Type persistentType );
/// <summary>
/// Get the <c>CollectionMetadata</c> associated with the named collection role
/// </summary>
/// <param name="roleName"></param>
/// <returns></returns>
ICollectionMetadata GetCollectionMetadata( string roleName );
/// <summary>
/// Get all <c>ClassMetadata</c> as a <c>IDictionary</c> from <c>Type</c>
/// to metadata object
/// </summary>
/// <returns></returns>
IDictionary GetAllClassMetadata();
/// <summary>
/// Get all <c>CollectionMetadata</c> as a <c>IDictionary</c> from role name
/// to metadata object
/// </summary>
/// <returns></returns>
IDictionary GetAllCollectionMetadata();
/// <summary>
/// Destroy this <c>SessionFactory</c> and release all resources
/// connection pools, etc). It is the responsibility of the application
/// to ensure that there are no open <c>Session</c>s before calling
/// <c>close()</c>.
/// </summary>
void Close();
/// <summary>
/// Evict all entries from the process-level cache. This method occurs outside
/// of any transaction; it performs an immediate "hard" remove, so does not respect
/// any transaction isolation semantics of the usage strategy. Use with care.
/// </summary>
/// <param name="persistentClass"></param>
void Evict( System.Type persistentClass );
/// <summary>
/// Evict an entry from the process-level cache. This method occurs outside
/// of any transaction; it performs an immediate "hard" remove, so does not respect
/// any transaction isolation semantics of the usage strategy. Use with care.
/// </summary>
/// <param name="persistentClass"></param>
/// <param name="id"></param>
void Evict( System.Type persistentClass, object id );
/// <summary>
/// Evict all entries from the process-level cache. This method occurs outside
/// of any transaction; it performs an immediate "hard" remove, so does not respect
/// any transaction isolation semantics of the usage strategy. Use with care.
/// </summary>
/// <param name="roleName"></param>
void EvictCollection( string roleName );
/// <summary>
/// Evict an entry from the process-level cache. This method occurs outside
/// of any transaction; it performs an immediate "hard" remove, so does not respect
/// any transaction isolation semantics of the usage strategy. Use with care.
/// </summary>
/// <param name="roleName"></param>
/// <param name="id"></param>
void EvictCollection( string roleName, object id );
}
}