Ejemplo n.º 1
0
 public TestAppConfig(IConfiguration configuration, IConfigurationRefresherProvider refresherProvider, IFeatureManagerSnapshot featureManagerSnapshot)
 {
     isLocal                 = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WEBSITE_INSTANCE_ID"));
     _configuration          = configuration;
     _featureManagerSnapshot = featureManagerSnapshot;
     _configurationRefresher = refresherProvider.Refreshers.First();
 }
 public HomeController(IAlbumService albumService, IFeatureManagerSnapshot featureManager, IOptionsSnapshot <AppSettings> options, ILogger <HomeController> logger)
 {
     _albumService   = albumService;
     _featureManager = featureManager;
     _appSettings    = options.Value;
     _logger         = logger;
 }
 public HomeController(ILogger <HomeController> logger, IFeatureManagerSnapshot featureManager,
                       IHttpContextAccessor contextAccessor)
 {
     _logger          = logger;
     _featureManager  = featureManager;
     _contextAccessor = contextAccessor;
 }
Ejemplo n.º 4
0
 public LeeBus(IConfiguration configuration, IConfigurationRefresherProvider refresherProvider, IFeatureManagerSnapshot featureManagerSnapshot)
 {
     isLocal                 = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WEBSITE_INSTANCE_ID"));
     _configuration          = configuration;
     _featureManagerSnapshot = featureManagerSnapshot;
     _configurationRefresher = refresherProvider.Refreshers.First();
     connString              = Environment.GetEnvironmentVariable("SqlServerConnection");
 }
Ejemplo n.º 5
0
 public NotificationController(ILoggerManger logger,
                               INotificationRepository notification,
                               IFeatureManagerSnapshot featureManager)
 {
     _logger         = logger ?? throw new ArgumentNullException(nameof(logger));
     _notification   = notification ?? throw new ArgumentNullException(nameof(notification));
     _featureManager = featureManager ?? throw new ArgumentNullException(nameof(featureManager));
 }
 public WeatherForecastController(ILogger <WeatherForecastController> logger, IOptionsSnapshot <Settings> settings,
                                  IFeatureManagerSnapshot featureManager
                                  , ITemperatureService temperatureService)
 {
     _settings           = settings;
     _featureManager     = featureManager;
     _temperatureService = temperatureService;
     _logger             = logger;
 }
 public PublishServiceAcceptanceStepContext(IFeatureManagerSnapshot featureManagerSnapshot,
                                            ICalculationsApiClient calculationsInMemoryClient,
                                            ICalculationResultsRepository calculationsInMemoryRepository,
                                            IProfilingApiClient profilingApiClient)
 {
     _featureManagerSnapshot        = featureManagerSnapshot;
     CalculationsInMemoryRepository = (CalculationInMemoryRepository)calculationsInMemoryRepository;
     CalculationsInMemoryClient     = (CalculationsInMemoryClient)calculationsInMemoryClient;
     ProfilingInMemoryClient        = (ProfilingInMemoryClient)profilingApiClient;
 }
        public FeatureManagementController(
            IOptionsMonitor <AppOptions> optionsMonitor,
            ConfigurationService optionsService,
            IFeatureManagerSnapshot featureManager)
        {
            _options = optionsMonitor.CurrentValue;
            optionsMonitor.OnChange(n => _options = n);

            _optionsService = optionsService;

            _featureManager = featureManager ?? throw new System.ArgumentNullException(nameof(featureManager));
        }
Ejemplo n.º 9
0
        public ConnectingDemo(IConfiguration configuration, IFeatureManagerSnapshot featureManagerSnapshot, IConfigurationRefresherProvider refresherProvider)
        {
            // Connects to a storage queue client. Address looks like https://identitydemo.queue.core.windows.net
            // The queuename is just a valid queue name.
            _client = new QueueClient(new Uri($"{configuration["Queue:Uri"]}/{configuration["Queue:Name"]}"),
                                      new DefaultAzureCredential(),
                                      new QueueClientOptions()
            {
                MessageEncoding = QueueMessageEncoding.Base64
            });
            _client.CreateIfNotExists();

            // Grab the feature flag API
            _featureManagerSnapshot = featureManagerSnapshot;
            _configurationRefresher = refresherProvider.Refreshers.First();
        }
        /// <summary>
        /// Performs controller action pre-procesing to ensure that at least one of the specified features are enabled.
        /// </summary>
        /// <param name="context">The context of the MVC action.</param>
        /// <param name="next">The action delegate.</param>
        /// <returns>Returns a task representing the action execution unit of work.</returns>
        public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            IFeatureManagerSnapshot fm = context.HttpContext.RequestServices.GetRequiredService <IFeatureManagerSnapshot>();

            //
            // Enabled state is determined by either 'any' or 'all' features being enabled.
            bool enabled = RequirementType == RequirementType.All ?
                           await Features.All(async feature => await fm.IsEnabledAsync(feature).ConfigureAwait(false)) :
                           await Features.Any(async feature => await fm.IsEnabledAsync(feature).ConfigureAwait(false));

            if (enabled)
            {
                await next().ConfigureAwait(false);
            }
            else
            {
                IDisabledFeaturesHandler disabledFeaturesHandler = context.HttpContext.RequestServices.GetService <IDisabledFeaturesHandler>() ?? new NotFoundDisabledFeaturesHandler();

                await disabledFeaturesHandler.HandleDisabledFeatures(Features, context).ConfigureAwait(false);
            }
        }
Ejemplo n.º 11
0
        public ClassSwitcher(IEnumerable <TInterface> classes, IFeatureManagerSnapshot featureManager, IEnumerable <IOptions <ClassSwitcherOptions> > options)
        {
            var classList = classes?.ToList() ?? throw new ArgumentNullException(nameof(classes));

            if (classList.Count < 2)
            {
                throw new ArgumentOutOfRangeException(nameof(classes), $"Minimum number of expected classes of {typeof(TInterface)} is 2, found {classList.Count}");
            }

            _featureManager = featureManager ?? throw new ArgumentNullException(nameof(featureManager));

            options = options?.ToList() ?? throw new ArgumentNullException(nameof(options));

            if (!options.Any())
            {
                throw new ArgumentNullException(nameof(options));
            }

            _option = options.FirstOrDefault(item => item.Value.Interface == typeof(TInterface))?.Value ?? throw new ArgumentOutOfRangeException(nameof(options), $"No options found for {typeof(TInterface)}");

            _flagDisabledClass = classList.FirstOrDefault(item => item.GetType() == typeof(TFlagDisabledClass));

            _flagEnabledClass = classList.FirstOrDefault(item => item.GetType() == typeof(TFlagEnabledClass));
        }
 public Function1(IFeatureManagerSnapshot featureManager)
 {
     _featureManager = featureManager;
 }
Ejemplo n.º 13
0
 public ShowBetaFeature(IFeatureManagerSnapshot featureManagerSnapshot, IConfigurationRefresherProvider refresherProvider)
 {
     _featureManagerSnapshot = featureManagerSnapshot;
     _configurationRefresher = refresherProvider.Refreshers.First();
 }
 public HomeController(IFeatureManager featureManager, IFeatureManagerSnapshot featureManagerSnapshot)
 {
     _featureManager         = featureManager;
     _featureManagerSnapshot = featureManagerSnapshot;
 }
Ejemplo n.º 15
0
 public FeatureFlags(IFeatureManagerSnapshot featureManagerSnapshot, IOptionsSnapshot <Settings> settings, IConfiguration configuration)
 {
     _featureManagerSnapshot = featureManagerSnapshot;
     _settings      = settings.Value;
     _configuration = configuration;
 }
Ejemplo n.º 16
0
 public HomeController(ILogger <HomeController> logger, IFeatureManagerSnapshot featureManager)
 {
     _logger         = logger;
     _featureManager = featureManager;
 }
Ejemplo n.º 17
0
 public AlbumService(IAlbumRepository albumRepository, IFeatureManagerSnapshot featureManager, IOptionsSnapshot <AppSettings> options)
 {
     _albumRepository = albumRepository;
     _featureManager  = featureManager;
     _appSettings     = options.Value;
 }
Ejemplo n.º 18
0
 public TimedController(IFeatureManagerSnapshot featureManager)
 {
     _featureManager = featureManager;
 }
Ejemplo n.º 19
0
 public ContratoController(IMemoryCache memoryCache, IFeatureManagerSnapshot featureManager)
 {
     _cache          = memoryCache;
     _featureManager = featureManager;
 }
Ejemplo n.º 20
0
 public ShowBetaFeature(IFeatureManagerSnapshot featureManagerSnapshot, ILoggerFactory loggerFactory)
 {
     _featureManagerSnapshot = featureManagerSnapshot;
     _logger = loggerFactory.CreateLogger <ShowBetaFeature>();
 }
 /// <summary>
 /// Creates a feature tag helper.
 /// </summary>
 /// <param name="featureManager">The feature manager snapshot to use to evaluate feature state.</param>
 public FeatureTagHelper(IFeatureManagerSnapshot featureManager)
 {
     _featureManager = featureManager;
 }
Ejemplo n.º 22
0
 public WeatherForecastController(ILogger <WeatherForecastController> logger, IFeatureManagerSnapshot featureManager)
 {
     _logger         = logger;
     _featureManager = featureManager;
 }
Ejemplo n.º 23
0
 public HomeController(IFeatureManagerSnapshot featureSnapshot) => FeatureManager = featureSnapshot;
Ejemplo n.º 24
0
 public IndexModel(ILogger <IndexModel> logger, BlogService blogService, IFeatureManagerSnapshot featureManager)
 {
     _blogService    = blogService;
     _featureManager = featureManager;
     _logger         = logger;
 }
Ejemplo n.º 25
0
 public FeatureManagerSnapshot(IFeatureManagerSnapshot baseFeatureManagerSnapshot)
 {
     _baseFeatureManagerSnapshot = baseFeatureManagerSnapshot;
 }
Ejemplo n.º 26
0
 public HelloWorld(IFeatureManagerSnapshot featureManagerSnapshot)
 {
     _featureManagerSnapshot = featureManagerSnapshot;
 }
Ejemplo n.º 27
0
 public HomeController(IHttpClientFactory httpClientFactory, IFeatureManagerSnapshot featureManager)
 {
     _cl             = httpClientFactory;
     _featureManager = featureManager;
 }
Ejemplo n.º 28
0
 public BetaModel(IFeatureManagerSnapshot featureManager)
 {
     _featureManager = featureManager;
 }
Ejemplo n.º 29
0
 public BetaController(IFeatureManagerSnapshot featureManager)
 {
     _featureManager = featureManager;
 }
Ejemplo n.º 30
0
 public HomeController(IFeatureManagerSnapshot featureManager)
 => _featureManager = featureManager;