src/Shared/EntityFramework/Core/Common/EntitySql/StaticContext.cs
// <summary>
// Rollback all scopes to the scope at the index.
// </summary>
Rollback all scopes to the scope at the index.
Rollback all scopes to the scope at the index .
internal void RollbackToScope(int scopeIndex)
        {
             assert preconditions
            Debug.Assert(scopeIndex >= 0, "[PRE] savePoint.ScopeIndex >= 0");
            Debug.Assert(scopeIndex <= CurrentScopeIndex, "[PRE] savePoint.ScopeIndex <= CurrentScopeIndex");
            Debug.Assert(CurrentScopeIndex >= 0, "[PRE] CurrentScopeIndex >= 0");
            if (scopeIndex > CurrentScopeIndex
                || scopeIndex < 0
                || CurrentScopeIndex < 0)
            {
                var message = Strings.InvalidSavePoint;
                throw new EntitySqlException(message);
            }
            var delta = CurrentScopeIndex - scopeIndex;
            if (delta > 0)
            {
                _scopes.RemoveRange(scopeIndex + 1, CurrentScopeIndex - scopeIndex);
            }
             make sure invariants are preserved
            Debug.Assert(scopeIndex == CurrentScopeIndex, "[POST] savePoint.ScopeIndex == CurrentScopeIndex");
            Debug.Assert(CurrentScopeIndex >= 0, "[POST] CurrentScopeIndex >= 0");
        }
internal void RollbackToScope ( int scopeIndex ) { Debug . Assert ( scopeIndex >= 0 , " " ) ; Debug . Assert ( scopeIndex <= CurrentScopeIndex , " " ) ; Debug . Assert ( CurrentScopeIndex >= 0 , " " ) ; if ( scopeIndex > CurrentScopeIndex || scopeIndex < 0 || CurrentScopeIndex < 0 ) { var message = Strings . InvalidSavePoint ; throw new EntitySqlException ( message ) ; } var delta = CurrentScopeIndex - scopeIndex ; if ( delta > 0 ) { _scopes . RemoveRange ( scopeIndex + 1 , CurrentScopeIndex - scopeIndex ) ; } Debug . Assert ( scopeIndex == CurrentScopeIndex , " " ) ; Debug . Assert ( CurrentScopeIndex >= 0 , " " ) ; }
Rollback all scopes to the scope at the index.
Rollback all scopes to the scope at the index .
// // assert preconditions // // // make sure invariants are preserved //
scopeIndex
int