Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed an issue where an outside session was disposed when the context…

… was disposed even though the session was passed into the context
  • Loading branch information...
commit e15c553468b41677ed3c768f7a4d09829e0c0bdb 1 parent fa770e0
@nberardi nberardi authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/CassandraContext.cs
View
4 src/CassandraContext.cs
@@ -14,6 +14,7 @@ public class CassandraContext : IDisposable
{
private readonly IList<IFluentMutationTracker> _trackers;
private CassandraSession _session;
+ private readonly bool _isOutsideSession = false;
/// <summary>
///
@@ -50,6 +51,7 @@ public CassandraContext(CassandraSession session)
: this(session.ConnectionBuilder)
{
_session = session;
+ _isOutsideSession = true;
}
/// <summary>
@@ -399,7 +401,7 @@ public void Dispose()
/// </param>
protected virtual void Dispose(bool disposing)
{
- if (!WasDisposed && disposing && _session != null)
+ if (!WasDisposed && !_isOutsideSession && disposing && _session != null)
{
_session.Dispose();
_session = null;
Please sign in to comment.
Something went wrong with that request. Please try again.