Изменения
This commit is contained in:
@@ -69,7 +69,7 @@ public static class EfCleanHelper
|
||||
public static string Truncate<T>(this DbSet<T> dbSet)
|
||||
where T : class
|
||||
{
|
||||
string cmd = $"TRUNCATE TABLE {TableName(dbSet)} CASCADE;";
|
||||
string cmd = $"TRUNCATE TABLE {TableName(dbSet)} RESTART IDENTITY CASCADE;";
|
||||
DbContext context = dbSet.GetService<ICurrentDbContext>().Context;
|
||||
context.Database.ExecuteSqlRaw(cmd);
|
||||
return cmd;
|
||||
@@ -87,7 +87,7 @@ public static class EfCleanHelper
|
||||
|
||||
foreach (IEntityType entityType in tables)
|
||||
{
|
||||
string cmd = $"TRUNCATE TABLE {GetName(entityType)} CASCADE;";
|
||||
string cmd = $"TRUNCATE TABLE {GetName(entityType)} RESTART IDENTITY CASCADE;";
|
||||
context.Database.ExecuteSqlRaw(cmd);
|
||||
cmdList.Add(cmd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user