using Inventory.Core; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using DotNetEnv; namespace Inventory.Agent { public class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) { Env.TraversePath().Load(); string dbCon = Env.GetString("DB_CONNECTION_STRING"); return Host.CreateDefaultBuilder(args) .UseWindowsService() .ConfigureServices((hostContext, services) => { services.AddDbContext(options => options.UseSqlServer(dbCon)); services.AddHttpClient(); services.AddSingleton(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddHostedService(); }); } } }