From 1d1f5266136d10e4415c289b2cbf698f89ad205e Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Sun, 26 May 2024 23:07:18 +0300 Subject: [PATCH] Fix --- src/BUTR.Site.NexusMods.Server/Program.cs | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/BUTR.Site.NexusMods.Server/Program.cs b/src/BUTR.Site.NexusMods.Server/Program.cs index 042fc659..9bc3f4d4 100644 --- a/src/BUTR.Site.NexusMods.Server/Program.cs +++ b/src/BUTR.Site.NexusMods.Server/Program.cs @@ -2,7 +2,6 @@ using BUTR.Site.NexusMods.Server.Extensions; using Microsoft.AspNetCore.Hosting; -using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -29,13 +28,6 @@ namespace BUTR.Site.NexusMods.Server; public static class Program { - private static void PreBulkSaveChanges(DbContext context) - { - if (context is AppDbContextRead) - AppDbContextRead.WriteNotSupported(); - } - private static void PreBulkOperation(DbContext context, object o) => PreBulkSaveChanges(context); - public static async Task Main(string[] args) { Log.Logger = new LoggerConfiguration() @@ -48,19 +40,6 @@ public static async Task Main(string[] args) { Log.Information("Starting web application"); - Z.EntityFramework.Extensions.EntityFrameworkManager.PreBulkInsert = PreBulkOperation; - Z.EntityFramework.Extensions.EntityFrameworkManager.PreBulkDelete = PreBulkOperation; - Z.EntityFramework.Extensions.EntityFrameworkManager.PreBulkMerge = PreBulkOperation; - Z.EntityFramework.Extensions.EntityFrameworkManager.PreBulkUpdate = PreBulkOperation; - Z.EntityFramework.Extensions.EntityFrameworkManager.PreBulkSynchronize = PreBulkOperation; - Z.EntityFramework.Extensions.EntityFrameworkManager.PreBulkSaveChanges = PreBulkSaveChanges; - Z.EntityFramework.Extensions.EntityFrameworkManager.ContextFactory = context => context switch - { - AppDbContextRead appDbContextRead => appDbContextRead.New(), - AppDbContextWrite appDbContextWrite => appDbContextWrite.New(), - _ => null - }; - var host = CreateHostBuilder(args).Build(); await host.SeedDbContext().RunAsync();