forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathISessionBuilder.cs
85 lines (76 loc) · 3.46 KB
/
ISessionBuilder.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
using System.Data.Common;
using NHibernate.Connection;
namespace NHibernate
{
// NH specific: Java does not require this, it looks as still having a better covariance support.
/// <summary>
/// Represents a consolidation of all session creation options into a builder style delegate.
/// </summary>
public interface ISessionBuilder : ISessionBuilder<ISessionBuilder> { }
/// <summary>
/// Represents a consolidation of all session creation options into a builder style delegate.
/// </summary>
public interface ISessionBuilder<T> where T : ISessionBuilder<T>
{
/// <summary>
/// Opens a session with the specified options.
/// </summary>
/// <returns>The session.</returns>
ISession OpenSession();
/// <summary>
/// Adds a specific interceptor to the session options.
/// </summary>
/// <param name="interceptor">The interceptor to use.</param>
/// <returns><see langword="this" />, for method chaining.</returns>
T Interceptor(IInterceptor interceptor);
/// <summary>
/// Signifies that no <see cref="IInterceptor"/> should be used.
/// </summary>
/// <returns><see langword="this" />, for method chaining.</returns>
/// <remarks>
/// By default the <see cref="IInterceptor"/> associated with the <see cref="ISessionFactory"/> is
/// passed to the <see cref="ISession"/> whenever we open one without the user having specified a
/// specific interceptor to use.
/// </remarks>
T NoInterceptor();
/// <summary>
/// Adds a specific connection to the session options.
/// </summary>
/// <param name="connection">The connection to use.</param>
/// <returns><see langword="this" />, for method chaining.</returns>
/// <remarks>
/// Note that the second-level cache will be disabled if you
/// supply a ADO.NET connection. NHibernate will not be able to track
/// any statements you might have executed in the same transaction.
/// Consider implementing your own <see cref="IConnectionProvider" />.
/// </remarks>
T Connection(DbConnection connection);
/// <summary>
/// Use a specific connection release mode for these session options.
/// </summary>
/// <param name="connectionReleaseMode">The connection release mode to use.</param>
/// <returns><see langword="this" />, for method chaining.</returns>
T ConnectionReleaseMode(ConnectionReleaseMode connectionReleaseMode);
/// <summary>
/// Should the session be automatically closed after transaction completion? Not yet implemented, will have no effect.
/// </summary>
/// <param name="autoClose">Should the session be automatically closed.</param>
/// <returns><see langword="this" />, for method chaining.</returns>
T AutoClose(bool autoClose);
/// <summary>
/// Should the session be automatically enlisted in ambient system transaction?
/// Enabled by default. Disabling it does not prevent connections having auto-enlistment
/// enabled to get enlisted in current ambient transaction when opened.
/// </summary>
/// <param name="autoJoinTransaction">Should the session be automatically explicitly
/// enlisted in ambient transaction.</param>
/// <returns><see langword="this" />, for method chaining.</returns>
T AutoJoinTransaction(bool autoJoinTransaction);
/// <summary>
/// Specify the initial FlushMode to use for the opened Session.
/// </summary>
/// <param name="flushMode">The initial FlushMode to use for the opened Session.</param>
/// <returns><see langword="this" />, for method chaining.</returns>
T FlushMode(FlushMode flushMode);
}
}