Пример #1
0
        public virtual async Task Reset(DbConnection connection)
        {
            if (string.IsNullOrWhiteSpace(DeleteSql))
            {
                DatabaseName = connection.Database;
                await BuildDeleteTables(connection);
            }

            if (_temporalTables.Any())
            {
                var turnOffVersioningCommandText = DbAdapter.BuildTurnOffSystemVersioningCommandText(_temporalTables);
                await ExecuteAlterSystemVersioningAsync(connection, turnOffVersioningCommandText);
            }

            await ExecuteDeleteSqlAsync(connection);

            if (_temporalTables.Any())
            {
                var turnOnVersioningCommandText = DbAdapter.BuildTurnOnSystemVersioningCommandText(_temporalTables);
                await ExecuteAlterSystemVersioningAsync(connection, turnOnVersioningCommandText);
            }
        }