src/Shared/EntityFramework/Internal/ClonedObjectContext.cs
// <summary>
// Disposes both the underlying ObjectContext and its store connection.
// </summary>
Disposes both the underlying ObjectContext and its store connection.
Disposes both the underlying ObjectContext and its store connection .
public void Dispose()
        {
            if (_objectContext != null)
            {
                var tempContext = _objectContext;
                var connection = Connection;
                _objectContext = null;
                tempContext.Dispose();
                _clonedEntityConnection.Dispose();
                if (_connectionCloned)
                {
                    DbInterception.Dispatch.Connection.Dispose(connection, new DbInterceptionContext());
                }
            }
        }
public void Dispose ( ) { if ( _objectContext != null ) { var tempContext = _objectContext ; var connection = Connection ; _objectContext = null ; tempContext . Dispose ( ) ; _clonedEntityConnection . Dispose ( ) ; if ( _connectionCloned ) { DbInterception . Dispatch . Connection . Dispose ( connection , new DbInterceptionContext ( ) ) ; } } }
Disposes both the underlying ObjectContext and its store connection.
Disposes both the underlying ObjectContext and its store connection .
// EntityConnection should be disposed of before store connection is disposed. EntityConnection dispose method unsubscribes from StateChanged event  // on the underlying store connection, so if order is reversed we try to modify an already disposed object.