DD.WellWorkover.Cloud/ConsoleApp1/Program.cs

50 lines
1.7 KiB
C#
Raw Normal View History

2021-09-29 10:12:54 +05:00
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using ClosedXML.Excel;
using ClosedXML.Excel.Drawings;
2021-09-29 10:12:54 +05:00
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);
2021-09-29 10:12:54 +05:00
class Program
2021-09-29 10:12:54 +05:00
{
2021-07-28 09:47:13 +05:00
static void Main(/*string[] args*/)
{
2021-09-29 10:12:54 +05:00
var options = new DbContextOptionsBuilder<AsbCloudDbContext>()
.UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True")
.Options;
2021-10-01 15:44:56 +05:00
using var db = new AsbCloudDbContext(options);
2021-09-29 10:12:54 +05:00
2021-10-01 15:44:56 +05:00
var cacheDb = new CacheDb();
var telemetryService = new TelemetryService(db, cacheDb);
var analyticsService = new TelemetryAnalyticsService(db,
telemetryService, cacheDb);
var sw = new System.Diagnostics.Stopwatch();
sw.Start();
analyticsService.AnalyzeAndSaveTelemetriesAsync().Wait();
sw.Stop();
Console.WriteLine(sw.ElapsedMilliseconds);
return;
2021-09-29 10:12:54 +05:00
var ts = new TelemetryService(db, new CacheDb());
var groups = ts.GetRedundentRemoteUids();
foreach(var g in groups)
ts.Merge(g.Ids);
2021-04-23 10:21:25 +05:00
2021-04-08 17:54:02 +05:00
Console.WriteLine("Done. Press any key to quit.");
Console.ReadKey();
}
}
}