using EFCore.BulkExtensions; using Hcs.WebApp.Data.Hcs; using Microsoft.EntityFrameworkCore; namespace Hcs.WebApp.Services { public class AccountService(IDbContextFactory factory) : HcsServiceBase(factory) { public async Task> GetAllAccountsAsync() { using var context = GetNewContext(); return await context.Accounts.ToListAsync(); } public async Task UpsertAccounts(HcsDbContext context, IEnumerable accounts) { await context.BulkInsertOrUpdateAsync(accounts, new BulkConfig() { PropertiesToExcludeOnUpdate = [ nameof(SupplyContract.ThirdPartyId) ], UpdateByProperties = [ nameof(SupplyContract.HcsId) ] }); } } }