forked from ddrilling/AsbCloudServer
43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using ClosedXML.Excel;
|
|
using ClosedXML.Excel.Drawings;
|
|
using AsbCloudApp.Data;
|
|
using AsbCloudDb.Model;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using AsbCloudInfrastructure.Services.Cache;
|
|
using AsbCloudInfrastructure.Services;
|
|
|
|
namespace ConsoleApp1
|
|
{
|
|
//var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
|
|
// .UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
|
|
// .Options;
|
|
//var context = new AsbCloudDbContext(options);
|
|
|
|
|
|
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 db = new AsbCloudDbContext(options);
|
|
|
|
var ts = new TelemetryService(db, new CacheDb());
|
|
var groups = ts.GetRedundentRemoteUids();
|
|
foreach(var g in groups)
|
|
ts.Merge(g.Ids);
|
|
//var sql = "UPDATE t_telemetry SET info = '{{\"a\":6}}' WHERE id = 2;\n" +
|
|
// "UPDATE t_telemetry SET info = '{{\"a\":1}}' WHERE id = 1;\n";
|
|
//db.Database.ExecuteSqlRaw(sql, 1);
|
|
|
|
Console.WriteLine("Done. Press any key to quit.");
|
|
Console.ReadKey();
|
|
}
|
|
}
|
|
}
|