forked from ddrilling/AsbCloudServer
fix analyze recomendations
This commit is contained in:
parent
496c24099d
commit
212989b3b6
@ -13,7 +13,7 @@ namespace AsbCloudDb
|
||||
{
|
||||
static Dictionary<Type, IQueryStringFactory> QueryFactories { get; set; } = new Dictionary<Type, IQueryStringFactory>();
|
||||
|
||||
static IQueryStringFactory GetQueryStringFactory<T>(DbSet<T> dbset, IEnumerable<T> items)
|
||||
static IQueryStringFactory GetQueryStringFactory<T>(DbSet<T> dbset)
|
||||
where T : class
|
||||
{
|
||||
var t = typeof(T);
|
||||
@ -30,7 +30,7 @@ namespace AsbCloudDb
|
||||
public static Task<int> ExecInsertOrUpdateAsync<T>(this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade database, DbSet<T> dbset, IEnumerable<T> items, CancellationToken token)
|
||||
where T : class
|
||||
{
|
||||
var factory = (QueryStringFactory<T>)GetQueryStringFactory(dbset, items);
|
||||
var factory = (QueryStringFactory<T>)GetQueryStringFactory(dbset);
|
||||
var query = factory.MakeInsertOrUpdateSql(items);
|
||||
return database.ExecuteSqlRawAsync(query, token);
|
||||
}
|
||||
@ -43,9 +43,9 @@ namespace AsbCloudDb
|
||||
{
|
||||
private readonly string pk;
|
||||
private readonly string tableName;
|
||||
private string colunmsString;
|
||||
private string conflictUpdateSet;
|
||||
private IEnumerable<IClrPropertyGetter> getters;
|
||||
private readonly string colunmsString;
|
||||
private readonly string conflictUpdateSet;
|
||||
private readonly IEnumerable<IClrPropertyGetter> getters;
|
||||
|
||||
public QueryStringFactory(DbSet<T> dbset)
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
return sharedUrl;
|
||||
}
|
||||
|
||||
public async Task<string> GetSharedUrlAsync(FileInfoDto fileInfo, int idUser,
|
||||
public async Task<string> GetSharedUrlAsync( FileInfoDto fileInfo, int idUser,
|
||||
CancellationToken token)
|
||||
{
|
||||
var fileWebUrl = fileInfo.PublishInfo?.WebStorageFileUrl;
|
||||
@ -118,8 +118,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
|
||||
using var newfileStream = new FileStream(filePath, FileMode.Create);
|
||||
await fileStream.CopyToAsync(newfileStream, token).ConfigureAwait(false);
|
||||
await fileStream.CopyToAsync(newfileStream);
|
||||
|
||||
|
||||
var dto = entry.Entity.Adapt<FileInfoDto>();
|
||||
return dto;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
CancellationToken token = default)
|
||||
{
|
||||
var command = service.Files.Delete(fileId);
|
||||
var result = await command.ExecuteAsync(token)
|
||||
await command.ExecuteAsync(token)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,6 @@ namespace AsbCloudInfrastructure.Services
|
||||
protected readonly CacheTable<Telemetry> cacheTelemetry;
|
||||
protected readonly CacheTable<TelemetryUser> cacheTelemetryUsers;
|
||||
protected readonly CacheTable<Well> cacheWells;
|
||||
private static int disorderId = (int)DateTime.Now.Ticks % 99;
|
||||
|
||||
public TelemetryDataBaseService(
|
||||
IAsbCloudDbContext db,
|
||||
@ -77,7 +76,6 @@ namespace AsbCloudInfrastructure.Services
|
||||
Trace.WriteLine($"Fail to save data telemerty uid: {uid}, idTelemetry {idTelemetry} count: {enitties.Count()} dataDate: {enitties.FirstOrDefault()?.Date}. Message: {ex.Message}");
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public virtual async Task<IEnumerable<TDto>> GetAsync(int idWell,
|
||||
|
@ -59,7 +59,7 @@ namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
var fileStream = file.OpenReadStream();
|
||||
await fileService.SaveAsync(idWell, idUser??0, idCategory, file.FileName,
|
||||
fileStream);
|
||||
fileStream, token).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return Ok();
|
||||
|
@ -18,18 +18,7 @@ namespace ConsoleApp1
|
||||
class Program
|
||||
{
|
||||
static void Main(/*string[] args*/)
|
||||
{
|
||||
var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
|
||||
.UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
|
||||
.Options;
|
||||
var context = new AsbCloudDbContext(options);
|
||||
|
||||
//var query = context.Clusters.GetInsertOrUpdateSql(
|
||||
// new List<Cluster> {
|
||||
// new Cluster{Caption = "cluster 1", },
|
||||
// new Cluster{Caption = "cluster 2"},
|
||||
// });
|
||||
|
||||
{
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user