Skip to content

Commit 0acd2cb

Browse files
Move in common overrides duplicated since connection manager own move.
1 parent f4ccb87 commit 0acd2cb

File tree

7 files changed

+43
-59
lines changed

7 files changed

+43
-59
lines changed

src/NHibernate/Async/Impl/StatelessSessionImpl.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using System;
1212
using System.Collections;
1313
using System.Collections.Generic;
14-
using System.Data.Common;
1514
using System.Linq.Expressions;
1615
using NHibernate.Cache;
1716
using NHibernate.Collection;

src/NHibernate/Engine/ISessionImplementor.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,16 @@ public partial interface ISessionImplementor
274274
bool IsOpen { get; }
275275

276276
/// <summary>
277-
/// Is the <c>ISession</c> currently connected?
277+
/// Is the session connected?
278278
/// </summary>
279+
/// <value>
280+
/// <see langword="true" /> if the session is connected.
281+
/// </value>
282+
/// <remarks>
283+
/// A session is considered connected if there is a <see cref="DbConnection"/> (regardless
284+
/// of its state) or if the field <c>connect</c> is true. Meaning that it will connect
285+
/// at the next operation that requires a connection.
286+
/// </remarks>
279287
bool IsConnected { get; }
280288

281289
FlushMode FlushMode { get; set; }

src/NHibernate/ISession.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,16 @@ public partial interface ISession : IDisposable
191191
bool IsOpen { get; }
192192

193193
/// <summary>
194-
/// Is the <c>ISession</c> currently connected?
194+
/// Is the session connected?
195195
/// </summary>
196+
/// <value>
197+
/// <see langword="true" /> if the session is connected.
198+
/// </value>
199+
/// <remarks>
200+
/// A session is considered connected if there is a <see cref="DbConnection"/> (regardless
201+
/// of its state) or if the field <c>connect</c> is true. Meaning that it will connect
202+
/// at the next operation that requires a connection.
203+
/// </remarks>
196204
bool IsConnected { get; }
197205

198206
/// <summary>

src/NHibernate/IStatelessSession.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,16 @@ public partial interface IStatelessSession : IDisposable
4545
bool IsOpen { get; }
4646

4747
/// <summary>
48-
/// Is the <c>IStatelessSession</c> currently connected?
48+
/// Is the session connected?
4949
/// </summary>
50+
/// <value>
51+
/// <see langword="true" /> if the session is connected.
52+
/// </value>
53+
/// <remarks>
54+
/// A session is considered connected if there is a <see cref="DbConnection"/> (regardless
55+
/// of its state) or if the field <c>connect</c> is true. Meaning that it will connect
56+
/// at the next operation that requires a connection.
57+
/// </remarks>
5058
bool IsConnected { get; }
5159

5260
/// <summary>

src/NHibernate/Impl/AbstractSessionImpl.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,16 @@ public ISessionFactoryImplementor Factory
108108
protected set => _factory = value;
109109
}
110110

111-
public abstract IBatcher Batcher { get; }
111+
// 6.0 TODO: remove virtual.
112+
/// <inheritdoc />
113+
public virtual IBatcher Batcher
114+
{
115+
get
116+
{
117+
CheckAndUpdateSessionStatus();
118+
return ConnectionManager.Batcher;
119+
}
120+
}
112121
public abstract void CloseSessionFromSystemTransaction();
113122

114123
public virtual IList List(IQueryExpression queryExpression, QueryParameters parameters)
@@ -244,8 +253,13 @@ public virtual IQuery GetNamedSQLQuery(string name)
244253
}
245254
}
246255

247-
// 6.0 TODO: remove virtual.
256+
// 6.0 TODO: remove virtual from below properties.
257+
/// <inheritdoc />
248258
public virtual ConnectionManager ConnectionManager { get; protected set; }
259+
/// <inheritdoc />
260+
public virtual bool IsConnected => ConnectionManager.IsConnected;
261+
/// <inheritdoc />
262+
public virtual DbConnection Connection => ConnectionManager.GetConnection();
249263

250264
public abstract IQueryTranslator[] GetQueries(IQueryExpression query, bool scalar);
251265
public abstract EventListeners Listeners { get; }
@@ -254,11 +268,9 @@ public virtual IQuery GetNamedSQLQuery(string name)
254268
public abstract IPersistenceContext PersistenceContext { get; }
255269
public abstract CacheMode CacheMode { get; set; }
256270
public abstract bool IsOpen { get; }
257-
public abstract bool IsConnected { get; }
258271
public abstract string FetchProfile { get; set; }
259272
public abstract string BestGuessEntityName(object entity);
260273
public abstract string GuessEntityName(object entity);
261-
public abstract DbConnection Connection { get; }
262274
public abstract int ExecuteNativeUpdate(NativeSQLQuerySpecification specification, QueryParameters queryParameters);
263275
public abstract FutureCriteriaBatch FutureCriteriaBatch { get; protected internal set; }
264276
public abstract FutureQueryBatch FutureQueryBatch { get; protected internal set; }

src/NHibernate/Impl/SessionImpl.cs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -229,16 +229,6 @@ protected internal set
229229
}
230230
}
231231

232-
/// <summary></summary>
233-
public override IBatcher Batcher
234-
{
235-
get
236-
{
237-
CheckAndUpdateSessionStatus();
238-
return ConnectionManager.Batcher;
239-
}
240-
}
241-
242232
public ConnectionReleaseMode ConnectionReleaseMode
243233
{
244234
get { return connectionReleaseMode; }
@@ -1452,27 +1442,6 @@ public override void InitializeCollection(IPersistentCollection collection, bool
14521442
}
14531443
}
14541444

1455-
public override DbConnection Connection
1456-
{
1457-
get { return ConnectionManager.GetConnection(); }
1458-
}
1459-
1460-
/// <summary>
1461-
/// Gets if the ISession is connected.
1462-
/// </summary>
1463-
/// <value>
1464-
/// <see langword="true" /> if the ISession is connected.
1465-
/// </value>
1466-
/// <remarks>
1467-
/// An ISession is considered connected if there is an <see cref="DbConnection"/> (regardless
1468-
/// of its state) or if it the field <c>connect</c> is true. Meaning that it will connect
1469-
/// at the next operation that requires a connection.
1470-
/// </remarks>
1471-
public override bool IsConnected
1472-
{
1473-
get { return ConnectionManager.IsConnected; }
1474-
}
1475-
14761445
/// <summary></summary>
14771446
public DbConnection Disconnect()
14781447
{

src/NHibernate/Impl/StatelessSessionImpl.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections;
33
using System.Collections.Generic;
4-
using System.Data.Common;
54
using System.Linq.Expressions;
65
using NHibernate.Cache;
76
using NHibernate.Collection;
@@ -88,15 +87,6 @@ public override long Timestamp
8887
get { throw new NotSupportedException(); }
8988
}
9089

91-
public override IBatcher Batcher
92-
{
93-
get
94-
{
95-
CheckAndUpdateSessionStatus();
96-
return ConnectionManager.Batcher;
97-
}
98-
}
99-
10090
public override void CloseSessionFromSystemTransaction()
10191
{
10292
Dispose(true);
@@ -333,11 +323,6 @@ public override bool IsOpen
333323
get { return !IsClosed; }
334324
}
335325

336-
public override bool IsConnected
337-
{
338-
get { return ConnectionManager.IsConnected; }
339-
}
340-
341326
public override FlushMode FlushMode
342327
{
343328
get { return FlushMode.Commit; }
@@ -365,11 +350,6 @@ public override string GuessEntityName(object entity)
365350
}
366351
}
367352

368-
public override DbConnection Connection
369-
{
370-
get { return ConnectionManager.GetConnection(); }
371-
}
372-
373353
public IStatelessSession SetBatchSize(int batchSize)
374354
{
375355
Batcher.BatchSize = batchSize;

0 commit comments

Comments
 (0)