// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); ServiceConfiguration.ConfigurePageStore(services); services.AddDbContext <PagesContext>( options => { options.UseSqlServer( Configuration.GetConnectionString("PortalCore_Pages"), sqlServerOptions => sqlServerOptions.MigrationsAssembly("PortalCore.DataAccess")); }); var tempServicePropvider = services.BuildServiceProvider(); services.AddMvc(); services.Configure <RazorViewEngineOptions>(options => { options.ViewLocationFormats.Add("{0}" + RazorViewEngine.ViewExtension); options.FileProviders.Add(new DatabaseFileProvider(tempServicePropvider.GetService <IPageRepository>())); }); ServiceConfiguration.ConfigureServices(services); }