Exemplo n.º 1
0
        /// <summary>
        /// Initialise the feature switching engine.
        /// </summary>
        /// <param name="config">The configuration settings for Femah.</param>
        public static void Initialise(FemahConfiguration config = null)
        {
            if (config == null)
            {
                config = new FemahConfiguration();
            }

            // Save context factory.
            _contextFactory = config.ContextFactory ?? new FemahContextFactory();

            // Save provider.
            _provider = config.Provider ?? new InProcProvider();

            if (config.StandardSwitchTypes.Count == 0)
                _switchTypes = LoadFeatureSwitchTypesFromAssembly(Assembly.GetExecutingAssembly());
            else
            {
                _switchTypes = new List<Type>();
                _switchTypes.AddRange(config.StandardSwitchTypes);
            }
            _switchTypes.AddRange(config.CustomSwitchTypes);

            _switches = Femah.LoadFeatureSwitchList(config.FeatureSwitchEnumType, Assembly.GetCallingAssembly());

            // Inialise the provider.
            _provider.Initialise(_switches.Values.ToList());

            _initialised = true;

            return;
        }
Exemplo n.º 2
0
 public FemahFluentConfiguration ContextFactory(IFemahContextFactory contextFactory)
 {
     _config.ContextFactory = contextFactory;
     return this;
 }