コード例 #1
0
 public TenantsRepository(IServiceProvider serviceProvider, MyHealthContext dbcontext, UserManager<ApplicationUser> userManager, MyHealthDataInitializer myHealthDataInitializer)
 {
     _context = dbcontext;
     _userManager = userManager;
     _myHealthDataInitializer = myHealthDataInitializer;
     _serviceProvider = serviceProvider;
 }
コード例 #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, MyHealthDataInitializer databaseInitializer)
        {
            databaseInitializer.InitializeDatabaseAsync(app.ApplicationServices).Wait();

            app.UseTestServerAuthentication();

            app.UseExceptionHandler(builder =>
            {
                builder.Run(context =>
                {
                    context.Response.StatusCode = 500;
                    return Task.FromResult(0);
                });
            });

            app.UseMvc();
        }
コード例 #3
0
        // Configure is called after ConfigureServices is called.
        public async void Configure(IApplicationBuilder app, IHostingEnvironment env, 
            ILoggerFactory loggerFactory, MyHealthDataInitializer dataInitializer)
        {
            // Add Application Insights monitoring to the request pipeline as a very first middleware.
            app.UseApplicationInsightsRequestTelemetry();

            loggerFactory.MinimumLevel = LogLevel.Information;
            loggerFactory.AddConsole();

            // Add the following to the request pipeline only in development environment.
            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage(options => options.EnableAll());
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            // Add Application Insights exceptions handling to the request pipeline.
            app.UseApplicationInsightsExceptionTelemetry();

            // Add static files to the request pipeline.
            app.UseStaticFiles();

            app.UseSession();

            app.ConfigureSecurity();
            
            // Add MVC to the request pipeline.
            app.ConfigureRoutes();

            app.UseIISPlatformHandler();

            await dataInitializer.InitializeDatabaseAsync(app.ApplicationServices);
        }