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();