コード例 #1
0
        public AppContext()
        {
            _appProfile = AppProfile.FromConfig();

            _dataSourceConfig = new DataSourceConfig(
                _appProfile.DataSource,
                _appProfile.Database,
                _appProfile.Username,
                _appProfile.Password
                );

            _addressRepository     = new AddressRepository(_dataSourceConfig);
            _billingInfoRepository = new BillingInfoRepository(_dataSourceConfig, _addressRepository);
            _contactInfoRepository = new ContactInfoRepository(_dataSourceConfig);
            _supplierRepository    = new SupplierRepository(_dataSourceConfig, _billingInfoRepository, _contactInfoRepository);
            _receiverRepository    = new ReceiverRepository(_dataSourceConfig, _billingInfoRepository, _contactInfoRepository);
            _itemRepository        = new InvoiceItemRepository(_dataSourceConfig);
            _paymentRepository     = new InvoicePaymentRepository(_dataSourceConfig);
            _invoiceRepository     = new InvoiceRepository(_dataSourceConfig, _supplierRepository, _receiverRepository, _itemRepository, _paymentRepository
                                                           );

            _addressService     = new AddressService(_addressRepository);
            _billingInfoService = new BillingInfoService(_billingInfoRepository);
            _contactInfoService = new ContactInfoService(_contactInfoRepository);
            _supplierService    = new SupplierService(_supplierRepository);
            _receiverService    = new ReceiverService(_receiverRepository);
            _itemService        = new InvoiceItemService(_itemRepository);
            _paymentService     = new InvoicePaymentService(_paymentRepository);
            _invoiceService     = new InvoiceService(_invoiceRepository);
        }
コード例 #2
0
        public void InitializeWithAppProfile(IAppProfile appProfile)
        {
            // Configurations
            _builder.Register(component => appProfile).As <IAppProfile>().SingleInstance();

            // Database
            _builder.RegisterType <DbConnection>().As <IDbConnection>().SingleInstance();
            _builder.RegisterType <DbInitializer>().As <IDbInitializer>().SingleInstance();

            // Installation repositories
            _builder.RegisterType <AddressRepository>().As <IAddressRepository>().SingleInstance();
            _builder.RegisterType <LocationRepository>().As <ILocationRepository>().SingleInstance();
            _builder.RegisterType <SponsorRepository>().As <ISponsorRepository>().SingleInstance();
            _builder.RegisterType <InstallationRepository>().As <IInstallationRepository>().SingleInstance();

            // Measurement repositories
            _builder.RegisterType <AirQualityIndexRepository>().As <IAirQualityIndexRepository>().SingleInstance();
            _builder.RegisterType <AirQualityStandardRepository>().As <IAirQualityStandardRepository>().SingleInstance();
            _builder.RegisterType <MeasurementValueRepository>().As <IMeasurementItemValueRepository>().SingleInstance();
            _builder.RegisterType <MeasurementItemRepository>().As <IMeasurementItemRepository>().SingleInstance();
            _builder.RegisterType <MeasurementRepository>().As <IMeasurementRepository>().SingleInstance();


            // Clients
            _builder.Register(component => CreateAirlyClient(appProfile)).As <IAirlyClient>().SingleInstance();
            //_builder.RegisterType<AirlyMockedClient>().As<IAirlyClient>().SingleInstance();

            // Services
            _builder.RegisterType <LocationService>().As <ILocationService>().SingleInstance();
            _builder.RegisterType <MeasurementsService>().As <IMeasurementsService>().SingleInstance();

            _container = _builder.Build();
        }
コード例 #3
0
ファイル: NavigationService.cs プロジェクト: yyou/yaringa
 public NavigationService(IContextService contextService, IAppProfile appProfile)
 {
     _contextService = contextService;
     _appProfile     = appProfile;
 }
コード例 #4
0
 private static IAirlyClient CreateAirlyClient(IAppProfile appProfile)
 => AirlyClientFactory.CreateClient(appProfile.ClientConfiguration.AirlyClientConfiguration);