|
|
|
|
@ -206,6 +206,17 @@ public class GenericController {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static async Task<int> RemoveAsync<T>(IList<T> entities) where T : class, IMetadata {
|
|
|
|
|
try {
|
|
|
|
|
await Task.Run(() => gremlinDb.Set<T>().RemoveRange(entities));
|
|
|
|
|
return await gremlinDb.SaveChangesAsync();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception exception) {
|
|
|
|
|
Console.WriteLine(exception.InnerException);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void HandleConcurrencyExceptions(DbUpdateException ex) {
|
|
|
|
|
Console.WriteLine($"!!! HandleConcurrencyException: {ex.Message}");
|
|
|
|
|
@ -231,7 +242,6 @@ public class GenericController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static async Task<int> RemoveDublicatesAsync<T>() where T : class, IMetadata {
|
|
|
|
|
try {
|
|
|
|
|
List<T> entities = gremlinDb.Set<T>().AsEnumerable().GroupBy(e => new { e.HashCode}).SelectMany(grp => grp.Skip(1)).ToList();
|
|
|
|
|
|