Esempio n. 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(
            IApplicationBuilder app, IHostingEnvironment env,
            ILoggerFactory loggerFactory, ToggleDbContext dbContext)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));

            if (env.IsDevelopment())
            {
                loggerFactory.AddDebug();
            }

            app.UseRequestSchemeFixer();

            app.UseCors(builder => builder
                        .AllowAnyHeader()
                        .AllowAnyMethod()
                        .AllowAnyOrigin());

            app.UseAuthentication();
            app.UseMvc();
            app.UseSwaggerUiHip();

            // Run migrations
            dbContext.Database.Migrate();
            ToggleDbInitializer.Initialize(dbContext);
        }
        public FeatureTogglesManagerBase(ToggleDbContext db)
        {
            Db = db;

            // Load standard groups which are always available and can't be deleted.
            // If this fails, the database is not correctly initialized.
            DefaultGroup = GetAllGroups(true, true)
                           .Include(g => g.EnabledFeatures)
                           .ThenInclude(m => m.Feature) // loading this is required for checking effectively enabled features
                           .ThenInclude(f => f.Children)
                           .Single(g => g.Name == FeatureGroup.DefaultGroupName);

            PublicGroup = GetAllGroups(true, true)
                          .Include(g => g.EnabledFeatures)
                          .ThenInclude(m => m.Feature) // loading this is required for checking effectively enabled features
                          .ThenInclude(f => f.Children)
                          .Single(g => g.Name == FeatureGroup.PublicGroupName);
        }
Esempio n. 3
0
 public FeatureGroupsManager(ToggleDbContext db) : base(db)
 {
 }