diff --git a/DysonNetwork.Drive/DysonNetwork.Drive.csproj b/DysonNetwork.Drive/DysonNetwork.Drive.csproj
index 5bd3555..9247df9 100644
--- a/DysonNetwork.Drive/DysonNetwork.Drive.csproj
+++ b/DysonNetwork.Drive/DysonNetwork.Drive.csproj
@@ -34,7 +34,6 @@
-
diff --git a/DysonNetwork.Drive/Storage/FileReferenceService.cs b/DysonNetwork.Drive/Storage/FileReferenceService.cs
index dd577e8..0959976 100644
--- a/DysonNetwork.Drive/Storage/FileReferenceService.cs
+++ b/DysonNetwork.Drive/Storage/FileReferenceService.cs
@@ -1,7 +1,6 @@
using DysonNetwork.Shared.Cache;
using DysonNetwork.Shared.Data;
using DysonNetwork.Shared.Models;
-using EFCore.BulkExtensions;
using Microsoft.EntityFrameworkCore;
using NodaTime;
@@ -59,16 +58,25 @@ public class FileReferenceService(AppDatabase db, FileService fileService, ICach
)
{
var now = SystemClock.Instance.GetCurrentInstant();
- var data = fileId.Select(id => new SnCloudFileReference
+ var finalExpiredAt = expiredAt;
+ if (finalExpiredAt == null && duration.HasValue)
{
- FileId = id,
- Usage = usage,
- ResourceId = resourceId,
- ExpiredAt = expiredAt ?? now + duration,
- CreatedAt = now,
- UpdatedAt = now
- }).ToList();
- await db.BulkInsertAsync(data);
+ finalExpiredAt = now + duration.Value;
+ }
+
+ var data = fileId.Select(id => new SnCloudFileReference
+ {
+ FileId = id,
+ Usage = usage,
+ ResourceId = resourceId,
+ ExpiredAt = finalExpiredAt,
+ CreatedAt = now,
+ UpdatedAt = now
+ })
+ .ToList();
+
+ db.FileReferences.AddRange(data);
+ await db.SaveChangesAsync();
return data;
}
diff --git a/DysonNetwork.Pass/DysonNetwork.Pass.csproj b/DysonNetwork.Pass/DysonNetwork.Pass.csproj
index 70b9ad0..b7d6cfc 100644
--- a/DysonNetwork.Pass/DysonNetwork.Pass.csproj
+++ b/DysonNetwork.Pass/DysonNetwork.Pass.csproj
@@ -24,7 +24,6 @@
-
diff --git a/DysonNetwork.Pass/Handlers/ActionLogFlushHandler.cs b/DysonNetwork.Pass/Handlers/ActionLogFlushHandler.cs
index 29218d2..a6be765 100644
--- a/DysonNetwork.Pass/Handlers/ActionLogFlushHandler.cs
+++ b/DysonNetwork.Pass/Handlers/ActionLogFlushHandler.cs
@@ -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();
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();
}
}
diff --git a/DysonNetwork.Ring/DysonNetwork.Ring.csproj b/DysonNetwork.Ring/DysonNetwork.Ring.csproj
index 275bb80..d422d1d 100644
--- a/DysonNetwork.Ring/DysonNetwork.Ring.csproj
+++ b/DysonNetwork.Ring/DysonNetwork.Ring.csproj
@@ -10,7 +10,6 @@
-
diff --git a/DysonNetwork.Sphere/DysonNetwork.Sphere.csproj b/DysonNetwork.Sphere/DysonNetwork.Sphere.csproj
index 7436f2a..b96fc25 100644
--- a/DysonNetwork.Sphere/DysonNetwork.Sphere.csproj
+++ b/DysonNetwork.Sphere/DysonNetwork.Sphere.csproj
@@ -12,7 +12,6 @@
-