I´m building a WebApi and i have some questions...
I created services for each request, like product, customer, sales, etc.. Each Service inject repositories tables that inherits from a base repository like:
public ProductService(IProductRepository productRepository,
IProductPriceRepository productPriceRepository,
IProductProviderRepository productProviderRepository)
{
}
And for example a SaleService requires other services like:
public SalesService(IDocumentService documentService,
ICustomerService customerService,
IProductService productService)
{
}
More or less that´s the architecture of my app. The question is that I need another database context for API configuration how is the proper way to make this without making injections redundants? Like :
public ProductService(IProductRepository productRepository,
IProductPriceRepository productPriceRepository,
IProductProviderRepository productProviderRepository,
ConfigurationApiContextService configurationApicontextService)
{
}
public SalesService(IDocumentService documentService,
ICustomerService customerService,
IProductService productService,
ConfigurationApiContextService configurationApicontextService)
{
}
I´m using IoC Unity. That´s a proper way to add another dataContext to services? It is posible to make that new dataContext global accesible for the entire app?
If this is a proper way, if later I want to add log4net package for logging the entire application, is there too much injections for service?
Sorry for those question, just started on WebApi ;)
And sorry for bad english too.
Thanks in advance.