private void ConfigureHttpClientUsage() { string hostSettingName = "apiHostNameAddress"; var baseAddress = ConfigurationManager.AppSettings[hostSettingName]; if (baseAddress == null) { throw new Exception($"The setting '{hostSettingName}' in the AppSettings portion of the configuration file was not found."); } var productsDataProxy = new ProductsHttpServiceProxy(baseAddress); var inventoryDataProxy = new InventoryItemsHttpServiceProxy(baseAddress); var customerDataProxy = new CustomersHttpServiceProxy(baseAddress); var orderItemDataProxy = new OrderItemsHttpServiceProxy(baseAddress); var orderRepository = new OrdersHttpServiceProxy(baseAddress); var categoriesDataProxy = new CategoriesHttpServiceProxy(baseAddress); _inventoryService = new InventoryItemService(inventoryDataProxy); _orderItemsService = new OrderItemClientService(orderItemDataProxy, productsDataProxy, inventoryDataProxy, new DTCTransactionContext()); _ordersService = new OrderService(orderRepository, _orderItemsService, new DTCTransactionContext()); _customersService = new CustomerService(customerDataProxy, _ordersService); _productsService = new ProductClientService(productsDataProxy, orderRepository, _inventoryService, new DTCTransactionContext()); _categoriesService = new CategoryService(categoriesDataProxy, productsDataProxy); this.DataContext = new MainWindowVM(_eventAggregator, _customersService, _productsService, _categoriesService, _ordersService, _inventoryService); }
private void ConfigureHttpClientUsage() { var productsDataProxy = new ProductsHttpServiceProxy(); var inventoryDataProxy = new InventoryItemsHttpServiceProxy(); var customerDataProxy = new CustomersHttpServiceProxy(); var orderItemDataProxy = new OrderItemsHttpServiceProxy(); var orderRepository = new OrdersHttpServiceProxy(); var categoriesDataProxy = new CategoriesHttpServiceProxy(); _inventoryService = new InventoryItemService(inventoryDataProxy); _orderItemsService = new OrderItemClientService(orderItemDataProxy, productsDataProxy, inventoryDataProxy, new DTCTransactionContext()); _ordersService = new OrderService(orderRepository, _orderItemsService, new DTCTransactionContext()); _customersService = new CustomerService(customerDataProxy, _ordersService); _productsService = new ProductClientService(productsDataProxy, orderRepository, _inventoryService, new DTCTransactionContext()); _categoriesService = new CategoryService(categoriesDataProxy, productsDataProxy); this.DataContext = new MainWindowVM(_eventAggregator, _customersService, _productsService, _categoriesService, _ordersService, _inventoryService); }