private void BindServices(ContainerBuilder builder) { builder.RegisterType <HttpRequestClient>().SingleInstance(); builder.RegisterType <BitcoinApiClient>() .As <IBitcoinApiClient>() .SingleInstance() .WithParameter(TypedParameter.From(_settings.BitCoinCore)); builder.RegisterType <OffchainRequestService>().As <IOffchainRequestService>(); builder.RegisterType <SrvSlackNotifications>() .SingleInstance() .WithParameter(TypedParameter.From(_settings.SlackIntegration)); var exchangeOperationsService = new ExchangeOperationsServiceClient(_jobSettings.ExchangeOperationsServiceUrl); builder.RegisterInstance(exchangeOperationsService).As <IExchangeOperationsService>().SingleInstance(); builder.Register <IAppNotifications>(x => new SrvAppNotifications( _settings.AppNotifications.HubConnString, _settings.AppNotifications.HubName)); builder.RegisterType <ChronoBankService>().As <IChronoBankService>().SingleInstance(); builder.RegisterType <SrvSolarCoinHelper>().As <ISrvSolarCoinHelper>().SingleInstance(); builder.RegisterType <QuantaService>().As <IQuantaService>().SingleInstance(); builder.Register <IEthereumApi>(x => { var api = new EthereumApi(new Uri(_settings.Ethereum.EthereumCoreUrl)); api.SetRetryPolicy(null); return(api); }).SingleInstance(); builder.RegisterType <SrvEthereumHelper>().As <ISrvEthereumHelper>().SingleInstance(); builder.RegisterType <MarginDataServiceResolver>() .As <IMarginDataServiceResolver>() .SingleInstance() .WithParameter(TypedParameter.From(_settings.MarginTrading)); builder.RegisterType <EmailSender>().As <IEmailSender>().SingleInstance(); builder.RegisterType <SrvEmailsFacade>().As <ISrvEmailsFacade>().SingleInstance(); builder.RegisterType <BitcoinTransactionService>().As <IBitcoinTransactionService>().SingleInstance(); var historyWriter = new HistoryWriter(_dbSettings.HistoryLogsConnString, _log); builder.RegisterInstance(historyWriter).As <IHistoryWriter>(); builder.RegisterType <PersonalDataService>() .As <IPersonalDataService>() .WithParameter(TypedParameter.From(_settings.PersonalDataServiceSettings)); }
private void RegisterExternalServices(ContainerBuilder builder) { builder.Register <IBitcoinApiClient>(x => { var client = new BitcoinApiClient(_settings.CurrentValue.BitCoinCore.BitcoinCoreApiUrl); return(client); }).SingleInstance(); builder.Register <IKycStatusService>(x => { var assetsSrv = new KycStatusServiceClient(_settings.CurrentValue.KycServiceClient, _log); return(assetsSrv); }).SingleInstance(); builder.Register <IAssetsService>(x => { var assetsSrv = new AssetsService(new Uri(_settings.CurrentValue.AssetsServiceClient.ServiceUrl)); return(assetsSrv); }).SingleInstance(); builder.Register <IExchangeOperationsServiceClient>(x => { var exchOpSrv = new ExchangeOperationsServiceClient(_settings.CurrentValue.ExchangeOperationsServiceClient.ServiceUrl); return(exchOpSrv); }).SingleInstance(); builder.RegisterType <BalancesClient>() .As <IBalancesClient>() .WithParameter("serviceUrl", _settings.CurrentValue.BalancesServiceClient.ServiceUrl) .WithParameter("log", _log) .SingleInstance(); builder.RegisterType <FirebaseService>() .As <IFirebaseService>() .WithParameter("settings", _settings.CurrentValue) .SingleInstance(); }