Permalink
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...
1 parent fa770e0 commit e15c553468b41677ed3c768f7a4d09829e0c0bdb @nberardi nberardi committed Jul 23, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 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;

0 comments on commit e15c553

Please sign in to comment.