Очистка кода

This commit is contained in:
KharchenkoVV 2021-05-20 11:17:55 +05:00
parent 4507b26581
commit 1c6990487f
6 changed files with 9 additions and 9 deletions

View File

@ -25,7 +25,7 @@ namespace AsbCloudInfrastructure.Services.Cache
cached.Clear();
var dbEntities = context.Set<TEntity>().ToList();
cached.AddRange(dbEntities);
return cached.Count();
return cached.Count;
}
public async Task<int> RefreshAsync(CancellationToken token = default)
@ -33,7 +33,7 @@ namespace AsbCloudInfrastructure.Services.Cache
cached.Clear();
var dbEntities = await context.Set<TEntity>().ToListAsync(token).ConfigureAwait(false);
cached.AddRange(dbEntities);
return cached.Count();
return cached.Count;
}
private bool CheckRefresh(RefreshMode refreshMode)

View File

@ -22,7 +22,7 @@ namespace AsbCloudInfrastructure.Services
public void Upsert(string uid, IEnumerable<EventDto> dtos)
{
if (dtos.Count() == 0)
if (!dtos.Any())
return;
var telemetryId = telemetryService.GetOrCreateTemetryIdByUid(uid);

View File

@ -22,7 +22,7 @@ namespace AsbCloudInfrastructure.Services
public void Upsert(string uid, IEnumerable<TelemetryUserDto> dtos)
{
if (dtos.Count() == 0)
if (!dtos.Any())
return;
var telemetryId = telemetryService.GetOrCreateTemetryIdByUid(uid);

View File

@ -25,7 +25,7 @@ namespace AsbCloudInfrastructure.Services
{
var wells = new List<Well>();
IEnumerable<string> activeTelemetriesUids = telemetryTracker.GetTransmittingTelemetryUids();
if (activeTelemetriesUids.Count() > 0)
if (activeTelemetriesUids.Any())
{
wells = db.GetWellsByCustomer(idCustomer)
.Where(w => activeTelemetriesUids.Contains(w.Telemetry.RemoteUid))

View File

@ -14,7 +14,7 @@ namespace AsbCloudWebApi
{
public static class DependencyInjection
{
public static void AddSwagger(this IServiceCollection services, IConfiguration configuration = null)
public static void AddSwagger(this IServiceCollection services)
{
services.AddSwaggerGen(c =>
{
@ -61,7 +61,7 @@ namespace AsbCloudWebApi
});
}
public static void AddJWTAuthentication(this IServiceCollection services, IConfiguration configuration = null)
public static void AddJWTAuthentication(this IServiceCollection services)
{
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>

View File

@ -21,11 +21,11 @@ namespace AsbCloudWebApi
{
services.AddControllers();
services.AddSwagger(Configuration);
services.AddSwagger();
services.AddInfrastructure(Configuration);
services.AddJWTAuthentication(Configuration);
services.AddJWTAuthentication();
services.AddSignalR();