From db04c2c0e622e169b009c69fcd9d19ac6bae37aa Mon Sep 17 00:00:00 2001 From: Hinton Date: Sun, 6 Apr 2025 23:09:37 +0900 Subject: [PATCH] Switch to LinqToDB for significant perf improvement --- util/Seeder/Commands/GenerateCommand.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/util/Seeder/Commands/GenerateCommand.cs b/util/Seeder/Commands/GenerateCommand.cs index 7d9b5e4aab..bf589046bc 100644 --- a/util/Seeder/Commands/GenerateCommand.cs +++ b/util/Seeder/Commands/GenerateCommand.cs @@ -2,6 +2,7 @@ using Bit.Seeder.Factories; using Bit.Seeder.Settings; using Bit.SharedWeb.Utilities; +using LinqToDB.EntityFrameworkCore; using Microsoft.AspNetCore.DataProtection; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -42,10 +43,12 @@ public class GenerateCommand db.Add(organization); db.Add(user); db.Add(orgUser); - db.AddRange(additionalUsers); - db.AddRange(additionalOrgUsers); db.SaveChanges(); + + // Use LinqToDB's BulkCopy for significant better performance + db.BulkCopy(additionalUsers); + db.BulkCopy(additionalOrgUsers); } return true;