Beispiel #1
0
        public static void ReconfigureServices()
        {
            var url = File.ReadAllText(@"..\..\..\configurationUrl.url");
            IServiceCollection _serviceCollection = new ServiceCollection();
            var cfgBuilder = new ConfigurationBuilder();

            cfgBuilder.AddInMemoryCollection(new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("ConnectionStrings:ConnectionString", url)
            });
            IConfigurationRoot root = cfgBuilder.Build();

            #region Automapper

            var mapper = new MapperConfiguration(cfg =>
            {
                cfg.AddProfiles(typeof(MongoDb.RegisterDependenciesExt).GetTypeInfo().Assembly);
            });
            _serviceCollection.AddSingleton(sp => mapper.CreateMapper());

            #endregion
            _serviceCollection.ConfigureServices(root);
            //IConfigurationSection indexerSettingsSection = configuration.GetSection("IndexerInstanceSettings");
            //IndexerInstanceSettings indexerSettings = indexerSettingsSection.Get<IndexerInstanceSettings>();
            IndexerInstanceSettings indexerSettings = new IndexerInstanceSettings()
            {
                IndexerId    = "EthereumSamurai.IntegrationTest_0",
                StartBlock   = 0,
                ThreadAmount = 1
            };
            //Register jobs and settings
            DependencyConfig.RegisterServices(_serviceCollection, indexerSettings);

            ServiceProvider = _serviceCollection.BuildServiceProvider();
        }
Beispiel #2
0
        protected override void Load(ContainerBuilder builder)
        {
            builder.RegisterInstance(_log)
            .As <ILog>()
            .SingleInstance();

            builder.RegisterType <IHealthService>()
            .As <IHealthService>()
            .SingleInstance();

            #region Automapper

            //Add automapper
            var mapper = new MapperConfiguration(cfg =>
            {
                cfg.AddProfiles(typeof(Service.EthereumSamurai.MongoDb.RegisterDependenciesExt).GetTypeInfo().Assembly);
            });
            builder.RegisterInstance(mapper.CreateMapper());

            #endregion

            IConfigurationSection   indexerSettingsSection = _configuration.GetSection("IndexerInstanceSettings");
            IndexerInstanceSettings indexerSettings        = indexerSettingsSection.Get <IndexerInstanceSettings>();
            _services.ConfigureServices(_configuration);
            DependencyConfig.RegisterServices(_services, indexerSettings);
            var baseSettings = _settings.CurrentValue.EthereumIndexer;
            //Console.WriteLine($"Geth node configured at {baseSettings.EthereumRpcUrl}");
            RegisterRabbitQueueEx.RegisterRabbitQueues(_services, baseSettings, _log);
            builder.Populate(_services);
        }
Beispiel #3
0
        static Program()
        {
            IKernel kernel = new StandardKernel();

            DependencyConfig.RegisterServices(kernel);

            logic = kernel.Get <ILogic>();
        }
Beispiel #4
0
        public static StandardKernel CreateKernel()
        {
            var kernel = new StandardKernel();

            kernel.Load(Assembly.GetExecutingAssembly());

            DependencyConfig.RegisterServices(kernel);
            //RegisterServices(kernel);
            return(kernel);
        }
        public void Configuration(IAppBuilder app)
        {
            var container = DependencyConfig.RegisterServices();

            DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

            app.UseAutofacMiddleware(container);
            app.UseAutofacMvc();

            ConfigureAuth(app);
        }
Beispiel #6
0
        // Implementação do exemplo baseada no post :  http://blog.lambda3.com.br/2009/11/domain-events/

        static void Main(string[] args)
        {
            DependencyConfig.RegisterServices();

            //criando uma reserva
            var reserva = Reserva.Create(1, 1);

            //alguma logica com a reserva...

            Console.ReadLine();
        }