public static int Main(string[] args) { Console.OutputEncoding = Encoding.UTF8; Console.WriteLine($"{typeof(Program).Namespace} ({string.Join(" ", args)}) starts working..."); var serviceCollection = new ServiceCollection(); ConfigureServices(serviceCollection); IServiceProvider serviceProvider = serviceCollection.BuildServiceProvider(true); var comMan = new CompaniesManagerService(); var data = comMan.GetCompanyAsync("200842897").GetAwaiter().GetResult(); Console.WriteLine(data); // Seed data on application startup // using (var serviceScope = serviceProvider.CreateScope()) // { // var dbContext = serviceScope.ServiceProvider.GetRequiredService<ApplicationDbContext>(); // dbContext.Database.Migrate(); // new ApplicationDbContextSeeder().SeedAsync(dbContext, serviceScope.ServiceProvider).GetAwaiter().GetResult(); // } using (var serviceScope = serviceProvider.CreateScope()) { serviceProvider = serviceScope.ServiceProvider; return(Parser.Default.ParseArguments <SandboxOptions>(args).MapResult( opts => SandboxCode(opts, serviceProvider).GetAwaiter().GetResult(), _ => 255)); } }
public DashboardController(BCKFreightTMS.Services.IPdfService pdfService) { this.companiesMan = new CompaniesManagerService(); this.pdfService = pdfService; }