Ejemplo n.º 1
0
        /// <summary>
        /// Loads the module into the kernel.
        /// </summary>
        public override void Load()
        {
            //Configuration Registry
            Bind <IConfigurationRegistry>().ToMethod((context) =>
            {
                var registry = new ConfigurationRegistry();

                registry.AddValue("StockTradingAnalysis_MSSQL", ConfigurationManager.ConnectionStrings["StockTradingAnalysis_MSSQL"].ConnectionString);
                registry.AddValue("StockTradingAnalysis_RavenDB", ConfigurationManager.ConnectionStrings["StockTradingAnalysis_RavenDB"].ConnectionString);

                return(registry);
            }).InSingletonScope();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads the binding configuration.
        /// </summary>
        /// <param name="serviceCollection">The service collection.</param>
        public void Load(IServiceCollection serviceCollection)
        {
            //Configuration Registry
            serviceCollection.AddSingleton <IConfigurationRegistry>(context =>
            {
                var registry = new ConfigurationRegistry();

                registry.AddValue("StockTradingAnalysis_MSSQL",
                                  DependencyResolver.Current.GetService <IConfiguration>()
                                  .GetConnectionString("StockTradingAnalysis_MSSQL"));

                registry.AddValue("StockTradingAnalysis_RavenDB",
                                  DependencyResolver.Current.GetService <IConfiguration>()
                                  .GetConnectionString("StockTradingAnalysis_RavenDB"));

                return(registry);
            });
        }