diff --git a/src/BUTR.Site.NexusMods.Server/Extensions/DbSetExtensions.cs b/src/BUTR.Site.NexusMods.Server/Extensions/DbSetExtensions.cs index 60a6a988..ed6a37f3 100644 --- a/src/BUTR.Site.NexusMods.Server/Extensions/DbSetExtensions.cs +++ b/src/BUTR.Site.NexusMods.Server/Extensions/DbSetExtensions.cs @@ -45,17 +45,17 @@ public static async Task SynchronizeOnSaveAsync(this DbSet dbS } - public static async Task UpsertAsync(this DbSet dbSet, IEnumerable entities) where TEntity : class, IEntity + public static async Task UpsertAsync(this DbSet dbSet, IEnumerable entities, bool @unsafe = false) where TEntity : class, IEntity { - await dbSet.BulkMergeAsync(entities); + await dbSet.BulkMergeAsync(entities, o => o.UnsafeMode = @unsafe); } - public static async Task UpsertAsync(this DbSet dbSet, IAsyncEnumerable entities) where TEntity : class, IEntity + public static async Task UpsertAsync(this DbSet dbSet, IAsyncEnumerable entities, bool @unsafe = false) where TEntity : class, IEntity { - await dbSet.BulkMergeAsync(await entities.ToArrayAsync()); + await dbSet.BulkMergeAsync(await entities.ToArrayAsync(), o => o.UnsafeMode = @unsafe); } - public static async Task UpsertAsync(this DbSet dbSet, params TEntity[] entities) where TEntity : class, IEntity + public static async Task UpsertAsync(this DbSet dbSet, bool @unsafe = false, params TEntity[] entities) where TEntity : class, IEntity { - await dbSet.BulkMergeAsync(entities); + await dbSet.BulkMergeAsync(entities, o => o.UnsafeMode = @unsafe); } public static async Task SynchronizeAsync(this DbSet dbSet, IEnumerable entities) where TEntity : class, IEntity diff --git a/src/BUTR.Site.NexusMods.Server/Jobs/AutocompleteProcessorProcessorJob.cs b/src/BUTR.Site.NexusMods.Server/Jobs/AutocompleteProcessorProcessorJob.cs index c4e72bb5..018ebb4e 100644 --- a/src/BUTR.Site.NexusMods.Server/Jobs/AutocompleteProcessorProcessorJob.cs +++ b/src/BUTR.Site.NexusMods.Server/Jobs/AutocompleteProcessorProcessorJob.cs @@ -95,7 +95,7 @@ private static async Task HandleTenantAsync(TenantId tenant, IServiceProvider se TenantId = tenant, Type = key, Value = x, - })); + }), true); } /*