Fix CrudWellRelated*Repository.. Get* method returns nonNullable values.

This commit is contained in:
ngfrolov 2023-02-15 18:00:48 +05:00
parent fda5385e46
commit eb18d73dd0
Signed by untrusted user who does not match committer: ng.frolov
GPG Key ID: E99907A0357B29A7
3 changed files with 6 additions and 6 deletions

View File

@ -20,7 +20,7 @@ namespace AsbCloudApp.Services
/// <param name="idWell">id скважины</param> /// <param name="idWell">id скважины</param>
/// <param name="token"></param> /// <param name="token"></param>
/// <returns>emptyList if nothing found</returns> /// <returns>emptyList if nothing found</returns>
Task<IEnumerable<Tdto>?> GetByIdWellAsync(int idWell, CancellationToken token); Task<IEnumerable<Tdto>> GetByIdWellAsync(int idWell, CancellationToken token);
/// <summary> /// <summary>
/// Получение всех записей по нескольким скважинам /// Получение всех записей по нескольким скважинам
@ -28,7 +28,7 @@ namespace AsbCloudApp.Services
/// <param name="idsWells">id скважин</param> /// <param name="idsWells">id скважин</param>
/// <param name="token"></param> /// <param name="token"></param>
/// <returns>emptyList if nothing found</returns> /// <returns>emptyList if nothing found</returns>
Task<IEnumerable<Tdto>?> GetByIdWellAsync(IEnumerable<int> idsWells, CancellationToken token); Task<IEnumerable<Tdto>> GetByIdWellAsync(IEnumerable<int> idsWells, CancellationToken token);
} }
#nullable disable #nullable disable
} }

View File

@ -21,7 +21,7 @@ namespace AsbCloudInfrastructure.Repository
public CrudWellRelatedCacheRepositoryBase(IAsbCloudDbContext context, IMemoryCache memoryCache, Func<DbSet<TEntity>, IQueryable<TEntity>> makeQuery) public CrudWellRelatedCacheRepositoryBase(IAsbCloudDbContext context, IMemoryCache memoryCache, Func<DbSet<TEntity>, IQueryable<TEntity>> makeQuery)
: base(context, memoryCache, makeQuery) { } : base(context, memoryCache, makeQuery) { }
public async Task<IEnumerable<TDto>?> GetByIdWellAsync(int idWell, CancellationToken token) public async Task<IEnumerable<TDto>> GetByIdWellAsync(int idWell, CancellationToken token)
{ {
var cache = await GetCacheAsync(token); var cache = await GetCacheAsync(token);
@ -32,7 +32,7 @@ namespace AsbCloudInfrastructure.Repository
return dtos; return dtos;
} }
public async Task<IEnumerable<TDto>?> GetByIdWellAsync(IEnumerable<int> idsWells, CancellationToken token) public async Task<IEnumerable<TDto>> GetByIdWellAsync(IEnumerable<int> idsWells, CancellationToken token)
{ {
if (!idsWells.Any()) if (!idsWells.Any())
return Enumerable.Empty<TDto>(); return Enumerable.Empty<TDto>();

View File

@ -20,7 +20,7 @@ namespace AsbCloudInfrastructure.Repository
public CrudWellRelatedRepositoryBase(IAsbCloudDbContext context, Func<DbSet<TEntity>, IQueryable<TEntity>> makeQuery) public CrudWellRelatedRepositoryBase(IAsbCloudDbContext context, Func<DbSet<TEntity>, IQueryable<TEntity>> makeQuery)
: base(context, makeQuery) { } : base(context, makeQuery) { }
public async Task<IEnumerable<TDto>?> GetByIdWellAsync(int idWell, CancellationToken token) public async Task<IEnumerable<TDto>> GetByIdWellAsync(int idWell, CancellationToken token)
{ {
var entities = await GetQuery() var entities = await GetQuery()
.Where(e => e.IdWell == idWell) .Where(e => e.IdWell == idWell)
@ -29,7 +29,7 @@ namespace AsbCloudInfrastructure.Repository
return dtos; return dtos;
} }
public async Task<IEnumerable<TDto>?> GetByIdWellAsync(IEnumerable<int> idsWells, CancellationToken token) public async Task<IEnumerable<TDto>> GetByIdWellAsync(IEnumerable<int> idsWells, CancellationToken token)
{ {
if (!idsWells.Any()) if (!idsWells.Any())
return Enumerable.Empty<TDto>(); return Enumerable.Empty<TDto>();