Example #1
0
 protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
 {
     if (!optionsBuilder.IsConfigured)
     {
         var connectionString = new SlickCMS.Core.ConnectionString();
         optionsBuilder.UseSqlServer(connectionString.Get());
     }
 }
Example #2
0
        // TODO: https://docs.microsoft.com/en-us/aspnet/core/performance/response-compression?view=aspnetcore-2.2

        // 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;
             * });*/

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            services.AddSession();

            var connectionString = new SlickCMS.Core.ConnectionString();

            services.AddDbContext <SlickCMSContext>(options => options.UseSqlServer(connectionString.Get(this.HostingEnvironment.ContentRootPath)));

            // add Entity Services
            services.AddScoped <IPostService, PostService>();
            services.AddScoped <ICommentService, CommentService>();
            services.AddScoped <ICategoryService, CategoryService>();
            services.AddScoped <ITagService, TagService>();
            services.AddScoped <IUserService, UserService>();
        }