public static void DeleteDataFromAllTables(this IDbInspector dbInspector) { var tableNames = dbInspector.GetTableNames(false); var scriptBuilder = dbInspector.Factory.CreateScriptBuilder(); foreach (var tableName in tableNames) { var sql = scriptBuilder.BuildDeleteScript(tableName); dbInspector.Connection.ExecuteSingleSql(sql); } }
public static IList <TableMold> GetTables( this IDbInspector dbInspector, bool?independentFirst = null, Func <string, bool> tableNamePredicate = null) { return(dbInspector .GetTableNames(independentFirst) .Where(tableNamePredicate ?? (x => true)) .Select(x => dbInspector .Factory .CreateTableInspector(dbInspector.Connection, x) .GetTable()) .ToList()); }