forked from ddrilling/AsbCloudServer
Очистка кода
This commit is contained in:
parent
4507b26581
commit
1c6990487f
@ -25,7 +25,7 @@ namespace AsbCloudInfrastructure.Services.Cache
|
|||||||
cached.Clear();
|
cached.Clear();
|
||||||
var dbEntities = context.Set<TEntity>().ToList();
|
var dbEntities = context.Set<TEntity>().ToList();
|
||||||
cached.AddRange(dbEntities);
|
cached.AddRange(dbEntities);
|
||||||
return cached.Count();
|
return cached.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> RefreshAsync(CancellationToken token = default)
|
public async Task<int> RefreshAsync(CancellationToken token = default)
|
||||||
@ -33,7 +33,7 @@ namespace AsbCloudInfrastructure.Services.Cache
|
|||||||
cached.Clear();
|
cached.Clear();
|
||||||
var dbEntities = await context.Set<TEntity>().ToListAsync(token).ConfigureAwait(false);
|
var dbEntities = await context.Set<TEntity>().ToListAsync(token).ConfigureAwait(false);
|
||||||
cached.AddRange(dbEntities);
|
cached.AddRange(dbEntities);
|
||||||
return cached.Count();
|
return cached.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CheckRefresh(RefreshMode refreshMode)
|
private bool CheckRefresh(RefreshMode refreshMode)
|
||||||
|
@ -22,7 +22,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
|
|
||||||
public void Upsert(string uid, IEnumerable<EventDto> dtos)
|
public void Upsert(string uid, IEnumerable<EventDto> dtos)
|
||||||
{
|
{
|
||||||
if (dtos.Count() == 0)
|
if (!dtos.Any())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var telemetryId = telemetryService.GetOrCreateTemetryIdByUid(uid);
|
var telemetryId = telemetryService.GetOrCreateTemetryIdByUid(uid);
|
||||||
|
@ -22,7 +22,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
|
|
||||||
public void Upsert(string uid, IEnumerable<TelemetryUserDto> dtos)
|
public void Upsert(string uid, IEnumerable<TelemetryUserDto> dtos)
|
||||||
{
|
{
|
||||||
if (dtos.Count() == 0)
|
if (!dtos.Any())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var telemetryId = telemetryService.GetOrCreateTemetryIdByUid(uid);
|
var telemetryId = telemetryService.GetOrCreateTemetryIdByUid(uid);
|
||||||
|
@ -25,7 +25,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
{
|
{
|
||||||
var wells = new List<Well>();
|
var wells = new List<Well>();
|
||||||
IEnumerable<string> activeTelemetriesUids = telemetryTracker.GetTransmittingTelemetryUids();
|
IEnumerable<string> activeTelemetriesUids = telemetryTracker.GetTransmittingTelemetryUids();
|
||||||
if (activeTelemetriesUids.Count() > 0)
|
if (activeTelemetriesUids.Any())
|
||||||
{
|
{
|
||||||
wells = db.GetWellsByCustomer(idCustomer)
|
wells = db.GetWellsByCustomer(idCustomer)
|
||||||
.Where(w => activeTelemetriesUids.Contains(w.Telemetry.RemoteUid))
|
.Where(w => activeTelemetriesUids.Contains(w.Telemetry.RemoteUid))
|
||||||
|
@ -14,7 +14,7 @@ namespace AsbCloudWebApi
|
|||||||
{
|
{
|
||||||
public static class DependencyInjection
|
public static class DependencyInjection
|
||||||
{
|
{
|
||||||
public static void AddSwagger(this IServiceCollection services, IConfiguration configuration = null)
|
public static void AddSwagger(this IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddSwaggerGen(c =>
|
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)
|
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||||
.AddJwtBearer(options =>
|
.AddJwtBearer(options =>
|
||||||
|
@ -21,11 +21,11 @@ namespace AsbCloudWebApi
|
|||||||
{
|
{
|
||||||
services.AddControllers();
|
services.AddControllers();
|
||||||
|
|
||||||
services.AddSwagger(Configuration);
|
services.AddSwagger();
|
||||||
|
|
||||||
services.AddInfrastructure(Configuration);
|
services.AddInfrastructure(Configuration);
|
||||||
|
|
||||||
services.AddJWTAuthentication(Configuration);
|
services.AddJWTAuthentication();
|
||||||
|
|
||||||
services.AddSignalR();
|
services.AddSignalR();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user