using EFCore.BulkExtensions; using Hcs.WebApp.Data.Hcs; using Microsoft.EntityFrameworkCore; namespace Hcs.WebApp.Services { public class HouseService(IDbContextFactory factory) : HcsServiceBase(factory) { public async Task> GetAllHousesAsync() { using var context = GetNewContext(); return await context.Houses.ToListAsync(); } public async Task UpsertHouses(IEnumerable houses) { using var context = GetNewContext(); await context.BulkInsertOrUpdateAsync(houses, new BulkConfig() { PropertiesToExcludeOnUpdate = [ nameof(House.ThirdPartyId) ], UpdateByProperties = [ nameof(House.HcsId) ] }); } } }