🐛 Fix error caused by EF BulkOperations rc by removing it.
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
<PackageReference Include="Quartz.AspNetCore" Version="3.15.1" />
|
||||
<PackageReference Include="Quartz.Extensions.Hosting" Version="3.15.1" />
|
||||
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
|
||||
<PackageReference Include="EFCore.BulkExtensions.PostgreSql" Version="10.0.0-rc.2" />
|
||||
<PackageReference Include="SpotifyAPI.Web" Version="7.2.1" />
|
||||
<PackageReference Include="SteamWebAPI2" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using DysonNetwork.Shared.Cache;
|
||||
using DysonNetwork.Shared.Models;
|
||||
using EFCore.BulkExtensions;
|
||||
using NodaTime;
|
||||
using Quartz;
|
||||
|
||||
@@ -14,12 +13,13 @@ public class ActionLogFlushHandler(IServiceProvider sp) : IFlushHandler<SnAction
|
||||
var db = scope.ServiceProvider.GetRequiredService<AppDatabase>();
|
||||
|
||||
var now = SystemClock.Instance.GetCurrentInstant();
|
||||
await db.BulkInsertAsync(items.Select(x =>
|
||||
foreach (var item in items)
|
||||
{
|
||||
x.CreatedAt = now;
|
||||
x.UpdatedAt = x.CreatedAt;
|
||||
return x;
|
||||
}), config => config.ConflictOption = ConflictOption.Ignore);
|
||||
item.CreatedAt = now;
|
||||
item.UpdatedAt = now;
|
||||
}
|
||||
db.ActionLogs.AddRange(items);
|
||||
await db.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user