From 1c6990487f266ba7d352ea40818a57800c089377 Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Thu, 20 May 2021 11:17:55 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=87=D0=B8=D1=81=D1=82=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudInfrastructure/Services/Cache/CacheTable.cs | 4 ++-- AsbCloudInfrastructure/Services/EventService.cs | 2 +- AsbCloudInfrastructure/Services/TelemetryUserService.cs | 2 +- AsbCloudInfrastructure/Services/WellService.cs | 2 +- AsbCloudWebApi/DependencyInjection.cs | 4 ++-- AsbCloudWebApi/Startup.cs | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/AsbCloudInfrastructure/Services/Cache/CacheTable.cs b/AsbCloudInfrastructure/Services/Cache/CacheTable.cs index 0e1b0e43..7b348643 100644 --- a/AsbCloudInfrastructure/Services/Cache/CacheTable.cs +++ b/AsbCloudInfrastructure/Services/Cache/CacheTable.cs @@ -25,7 +25,7 @@ namespace AsbCloudInfrastructure.Services.Cache cached.Clear(); var dbEntities = context.Set().ToList(); cached.AddRange(dbEntities); - return cached.Count(); + return cached.Count; } public async Task RefreshAsync(CancellationToken token = default) @@ -33,7 +33,7 @@ namespace AsbCloudInfrastructure.Services.Cache cached.Clear(); var dbEntities = await context.Set().ToListAsync(token).ConfigureAwait(false); cached.AddRange(dbEntities); - return cached.Count(); + return cached.Count; } private bool CheckRefresh(RefreshMode refreshMode) diff --git a/AsbCloudInfrastructure/Services/EventService.cs b/AsbCloudInfrastructure/Services/EventService.cs index 0038ed04..b8762dda 100644 --- a/AsbCloudInfrastructure/Services/EventService.cs +++ b/AsbCloudInfrastructure/Services/EventService.cs @@ -22,7 +22,7 @@ namespace AsbCloudInfrastructure.Services public void Upsert(string uid, IEnumerable dtos) { - if (dtos.Count() == 0) + if (!dtos.Any()) return; var telemetryId = telemetryService.GetOrCreateTemetryIdByUid(uid); diff --git a/AsbCloudInfrastructure/Services/TelemetryUserService.cs b/AsbCloudInfrastructure/Services/TelemetryUserService.cs index 4b00b936..91576a1f 100644 --- a/AsbCloudInfrastructure/Services/TelemetryUserService.cs +++ b/AsbCloudInfrastructure/Services/TelemetryUserService.cs @@ -22,7 +22,7 @@ namespace AsbCloudInfrastructure.Services public void Upsert(string uid, IEnumerable dtos) { - if (dtos.Count() == 0) + if (!dtos.Any()) return; var telemetryId = telemetryService.GetOrCreateTemetryIdByUid(uid); diff --git a/AsbCloudInfrastructure/Services/WellService.cs b/AsbCloudInfrastructure/Services/WellService.cs index a358c97b..cdacfe9c 100644 --- a/AsbCloudInfrastructure/Services/WellService.cs +++ b/AsbCloudInfrastructure/Services/WellService.cs @@ -25,7 +25,7 @@ namespace AsbCloudInfrastructure.Services { var wells = new List(); IEnumerable activeTelemetriesUids = telemetryTracker.GetTransmittingTelemetryUids(); - if (activeTelemetriesUids.Count() > 0) + if (activeTelemetriesUids.Any()) { wells = db.GetWellsByCustomer(idCustomer) .Where(w => activeTelemetriesUids.Contains(w.Telemetry.RemoteUid)) diff --git a/AsbCloudWebApi/DependencyInjection.cs b/AsbCloudWebApi/DependencyInjection.cs index 9fc7ad1e..3c4cec14 100644 --- a/AsbCloudWebApi/DependencyInjection.cs +++ b/AsbCloudWebApi/DependencyInjection.cs @@ -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 => diff --git a/AsbCloudWebApi/Startup.cs b/AsbCloudWebApi/Startup.cs index 6abe83b7..32ac89a1 100644 --- a/AsbCloudWebApi/Startup.cs +++ b/AsbCloudWebApi/Startup.cs @@ -21,11 +21,11 @@ namespace AsbCloudWebApi { services.AddControllers(); - services.AddSwagger(Configuration); + services.AddSwagger(); services.AddInfrastructure(Configuration); - services.AddJWTAuthentication(Configuration); + services.AddJWTAuthentication(); services.AddSignalR();