Пример #1
0
    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }

        app.UseFileServer();
        app.UseAuthentication();
        app.UseMvc(routes => routes.MapRoute("default", "{controller=Stores}/{action=Index}/{id?}"));
        MyDbContextSeedData.Initialize(app.ApplicationServices, _config).Wait();
    }
Пример #2
0
        protected override async void OnStartup(StartupEventArgs e)
        {
            await _host.StartAsync();

            await MyDbContextSeedData.Initialize(_host.Services, Config);

            var bookRepository = _host.Services.GetRequiredService <IBookRepository>();
            var threadStart    = new ThreadStart(async() => await CheckBooksForExpiration(bookRepository));
            var thread         = new Thread(threadStart);

            thread.Start();
            var window = _host.Services.GetRequiredService <MainWindow>();

            window.DataContext = _host.Services.GetRequiredService <MainViewModel>();
            window.Show();
            base.OnStartup(e);
        }