This commit is contained in:
ai.astrakhantsev 2022-12-07 15:23:10 +05:00
parent 07fe9fcc5a
commit 252c45ac00
2 changed files with 9 additions and 9 deletions

View File

@ -29,7 +29,7 @@ namespace AsbCloudInfrastructure.Repository
{ } { }
/// <inheritdoc/> /// <inheritdoc/>
public virtual async Task<IEnumerable<TDto>> GetAllAsync(CancellationToken token = default) public virtual async Task<IEnumerable<TDto>> GetAllAsync(CancellationToken token)
{ {
var entities = await GetQuery() var entities = await GetQuery()
.AsNoTracking() .AsNoTracking()
@ -40,7 +40,7 @@ namespace AsbCloudInfrastructure.Repository
} }
/// <inheritdoc/> /// <inheritdoc/>
public virtual async Task<TDto?> GetOrDefaultAsync(int id, CancellationToken token = default) public virtual async Task<TDto?> GetOrDefaultAsync(int id, CancellationToken token)
{ {
var entity = await GetQuery() var entity = await GetQuery()
.AsNoTracking() .AsNoTracking()
@ -65,7 +65,7 @@ namespace AsbCloudInfrastructure.Repository
} }
/// <inheritdoc/> /// <inheritdoc/>
public virtual async Task<int> InsertAsync(TDto item, CancellationToken token = default) public virtual async Task<int> InsertAsync(TDto item, CancellationToken token)
{ {
var entity = Convert(item); var entity = Convert(item);
entity.Id = 0; entity.Id = 0;
@ -76,7 +76,7 @@ namespace AsbCloudInfrastructure.Repository
} }
/// <inheritdoc/> /// <inheritdoc/>
public virtual async Task<int> InsertRangeAsync(IEnumerable<TDto> items, CancellationToken token = default) public virtual async Task<int> InsertRangeAsync(IEnumerable<TDto> items, CancellationToken token)
{ {
if (!items.Any()) if (!items.Any())
return 0; return 0;
@ -98,7 +98,7 @@ namespace AsbCloudInfrastructure.Repository
} }
/// <inheritdoc/> /// <inheritdoc/>
public virtual async Task<int> UpdateAsync(TDto item, CancellationToken token = default) public virtual async Task<int> UpdateAsync(TDto item, CancellationToken token)
{ {
var existingEntity = await dbSet var existingEntity = await dbSet
.AsNoTracking() .AsNoTracking()
@ -116,7 +116,7 @@ namespace AsbCloudInfrastructure.Repository
} }
/// <inheritdoc/> /// <inheritdoc/>
public virtual Task<int> DeleteAsync(int id, CancellationToken token = default) public virtual Task<int> DeleteAsync(int id, CancellationToken token)
{ {
var entity = dbSet var entity = dbSet
.AsNoTracking() .AsNoTracking()

View File

@ -26,9 +26,9 @@ namespace AsbCloudWebApi.Controllers
{ {
protected readonly TService service; protected readonly TService service;
public Func<T, CancellationToken, Task<bool>> InsertForbidAsync { get; protected set; } = null; public Func<T, CancellationToken, Task<bool>> InsertForbidAsync { get; protected set; } = null!;
public Func<T, CancellationToken, Task<bool>> UpdateForbidAsync { get; protected set; } = null; public Func<T, CancellationToken, Task<bool>> UpdateForbidAsync { get; protected set; } = null!;
public Func<int, CancellationToken, Task<bool>> DeleteForbidAsync { get; protected set; } = null; public Func<int, CancellationToken, Task<bool>> DeleteForbidAsync { get; protected set; } = null!;
public CrudController(TService service) public CrudController(TService service)
{ {