refactor(infrastructure): rename CreateAsync bulk overload to CreateRangeAsync and use AsNoTracking in ReceivedEmailRepository
This commit is contained in:
@@ -11,7 +11,7 @@ public class ReceivedEmailRepository(MessagingServiceDbContext Context, IMapper
|
|||||||
{
|
{
|
||||||
public async Task<IEnumerable<ReceivedEmail>> FindAsync(MailSearchFilter mailSearchFilter, EmailAccount? accountQuery = null, CancellationToken cancellationToken = default)
|
public async Task<IEnumerable<ReceivedEmail>> FindAsync(MailSearchFilter mailSearchFilter, EmailAccount? accountQuery = null, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
IQueryable<ReceivedEmail> query = DbSet;
|
var query = DbSet.AsNoTracking();
|
||||||
|
|
||||||
// ── Account filter ─────────────────────────────────────────────────────
|
// ── Account filter ─────────────────────────────────────────────────────
|
||||||
if (accountQuery is not null)
|
if (accountQuery is not null)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class Repository<TEntity>(MessagingServiceDbContext Context, IMapper Mapp
|
|||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<TEntity>> CreateAsync<TDto>(IEnumerable<TDto> dtos, CancellationToken cancellationToken = default)
|
public async Task<IEnumerable<TEntity>> CreateRangeAsync<TDto>(IEnumerable<TDto> dtos, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var entities = Mapper.Map<IEnumerable<TEntity>>(dtos);
|
var entities = Mapper.Map<IEnumerable<TEntity>>(dtos);
|
||||||
await DbSet.AddRangeAsync(entities, cancellationToken);
|
await DbSet.AddRangeAsync(entities, cancellationToken);
|
||||||
|
|||||||
Reference in New Issue
Block a user