Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed May 26, 2024
1 parent f54a7ef commit 1d1f526
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/BUTR.Site.NexusMods.Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()
Expand All @@ -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<BaseAppDbContext>().RunAsync();
Expand Down

0 comments on commit 1d1f526

Please sign in to comment.