Exemplo n.º 1
0
        /// <summary>
        /// Loads configurations from files
        /// </summary>
        /// <returns></returns>
        private static void AddConfiguration()
        {
            FileConfigurationProvider ConfigurationProviderForFile(string name) =>
            new()
            {
                File           = name,
                Path           = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "configs"),
                ReloadOnAccess = false
            };

            // Required by Signals
            ApplicationConfiguration.UseProvider(ConfigurationProviderForFile("app.config.json"));
            WebApplicationConfiguration.UseProvider(ConfigurationProviderForFile("web.config.json"));
        }
    }
Exemplo n.º 2
0
        /// <summary>
        /// CTOR
        /// </summary>
        public WebMediatorTests()
        {
            ApplicationConfiguration.UseProvider(new FileConfigurationProvider
            {
                Path = Path.Combine(AppContext.BaseDirectory, "config"),
                File = "app.json"
            });
            WebApplicationConfiguration.UseProvider(new FileConfigurationProvider
            {
                Path = Path.Combine(AppContext.BaseDirectory, "config"),
                File = "webapp.json"
            });

            var config = new Config();

            config.RegistrationService = new Aspects.DI.Autofac.RegistrationService();
            config.CacheConfiguration  = new InMemoryCacheConfiguration();
            config.Bootstrap(typeof(MediatorTests).Assembly);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Load configuration from files
        /// </summary>
        /// <param name="services"></param>
        /// <returns></returns>
        private static void AddConfiguration(this IServiceCollection services)
        {
            string environment = null;

            FileConfigurationProvider ProviderForFile(string name) => new FileConfigurationProvider
            {
                File           = name,
                Path           = environment.IsNullOrEmpty() ? Path.Combine(AppContext.BaseDirectory, $"configs") : Path.Combine(AppContext.BaseDirectory, $"configs", environment),
                ReloadOnAccess = false
            };

            // set active configuration
            EnvironmentConfiguration.UseProvider(ProviderForFile("environment.config.json"));
            environment = EnvironmentConfiguration.Instance.Environment;

            // load custom configurations from file

            // Signals core application configuration
            ApplicationConfiguration.UseProvider(ProviderForFile("application.config.json"));
            // Signals core web application configuration
            WebApplicationConfiguration.UseProvider(ProviderForFile("web.application.config.json"));
            // Application custom domain configuration
            DomainConfiguration.UseProvider(ProviderForFile("domain.config.json"));
        }