Beispiel #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            //Set up database
            var databaseSetup = new DatabaseSetup(Configuration, services);

            databaseSetup.Configure();

            //Confirgure services (DI)
            var serviceSetup = new ServiceSetup(Configuration, services);

            serviceSetup.ConfigureBasic();
            serviceSetup.ConfigureAuthentication();
            serviceSetup.ConfigureServices();
            serviceSetup.ConfigureLogging();

            var identitySetup = new IdentitySetup(Configuration, services);

            identitySetup.Configure();

            var emailSetup = new EmailSetup(Configuration, services);

            emailSetup.Configure();

            services.AddApplicationInsightsTelemetry();
        }
Beispiel #2
0
        /// <summary>
        ///     Compose the application according to the supplied configuration
        /// </summary>
        /// <param name="services">The service collection to register services into.</param>
        /// <param name="applicationConfiguration">Application configuration.</param>
        public static void Configure(IServiceCollection services, ApplicationConfiguration applicationConfiguration)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            services.AddSingleton(applicationConfiguration);
            services.AddSingleton(typeof(ExecutionEnvironment), implementationInstance: applicationConfiguration.Environment);
            services.AddHttpContextAccessor();

            services.AddSingleton <IRandomSource, DefaultRandomSource>();

            SecurityServices.ConfigureWalletSalt(services: services, walletSaltString: applicationConfiguration.WalletSalt);

            EthereumAccountsSetup.Configure(services);

            string configurationFolder = ApplicationConfigLocator.ConfigurationFilesPath;

            AlertDispatcherSetup.Configure(services: services, configuration: applicationConfiguration.Configuration, pluginsPath: configurationFolder);

            CommonMiddlewareServicesSetup.Configure(services: services);
            CommonServicesSetup.Configure(services);

            ContractsSetup.Configure(services);

            EthereumServices.ConfigureEthereumServices(services: services, configuration: applicationConfiguration);

            DatabaseSetup.Configure(services: services, configuration: applicationConfiguration.SqlServerConfiguration);

            ServiceInterfacesSetup.Configure(services);
            ServiceInterfaceHubSetup.Configure(services);

            ObjectLockingSetup.Configure(serviceCollection: services, applicationConfiguration.Environment.IsLocalOrTest());

            LogicSetup.Configure(services: services,
                                 faucetConfiguration: applicationConfiguration.FaucetConfiguration,
                                 faucetBalanceConfiguration: applicationConfiguration.FaucetBalanceConfiguration,
                                 houseAlerterConfiguration: applicationConfiguration.HouseBalanceConfiguration);
        }