Skip to content

Commit 51b6ee8

Browse files
Additional move of duplicated code.
1 parent 875f28d commit 51b6ee8

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/NHibernate/Impl/AbstractSessionImpl.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,14 @@ protected internal void SetClosed()
407407
closed = true;
408408
}
409409

410+
protected DbConnection CloseConnectionManager()
411+
{
412+
if (!TransactionCoordinatorShared)
413+
return ConnectionManager.Close();
414+
ConnectionManager.RemoveDependentSession(this);
415+
return null;
416+
}
417+
410418
private void InitQuery(IQuery query, NamedQueryDefinition nqd)
411419
{
412420
query.SetCacheable(nqd.IsCacheable);

src/NHibernate/Impl/SessionImpl.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,7 @@ public DbConnection Close()
278278

279279
try
280280
{
281-
if (!TransactionCoordinatorShared)
282-
return ConnectionManager.Close();
283-
ConnectionManager.RemoveDependentSession(this);
284-
return null;
281+
return CloseConnectionManager();
285282
}
286283
finally
287284
{

src/NHibernate/Impl/StatelessSessionImpl.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,10 +443,7 @@ public void ManagedClose()
443443
{
444444
throw new SessionException("Session was already closed!");
445445
}
446-
if (TransactionCoordinatorShared)
447-
ConnectionManager.RemoveDependentSession(this);
448-
else
449-
ConnectionManager.Close();
446+
CloseConnectionManager();
450447
SetClosed();
451448
}
452449
}

0 commit comments

Comments
 (0)