// See https://aka.ms/new-console-template for more information

using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Pomelo.EntityFrameworkCore;
using Pos.Dispatcher;
using Pos.Dispatcher.Database;
using Pos.Dispatcher.Database.Model;

HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
LoadConfig loadConfig = new LoadConfig();
IConfiguration config = loadConfig.ByEnvironment();
builder.Services.AddSingleton(config);
builder.Services.AddDbContext<PosDispatcherContext>();
builder.Services.AddScoped<Synchronize>();
using IHost host = builder.Build();

Synchronize synchronize = host.Services.GetRequiredService<Synchronize>();
synchronize.Go();