I have 3 builds of Presenter, Business and DataAccess. Lead, referring to business and business, referring to DataAccess.
I have a CustomerBusiness class, in a Business assembly, with two constructors with one parameter. The first constructor is used only for testing to make fun of a data access object. ICustomerDataAccess in the DataAccess assembly.
class CustomerBusiness() { private ICustomerDataAccess _data= null; public CustomerBusiness(ICustomerDataAccess data) { _data = data; } public CustomerBusiness(string language): this(new CustomerDataAccess("language")) {} public void SomeOtherMethods() { ... } }
In the CustomerPresenter class, I wrote the code below, which gives an error that the DataAccess assembly is not referenced in Presenter. But I do not want to add a link to DataAccess in Presenter.
var custBusiness = new client business ("English")
Can anyone recommend a better way to implement this while avoiding references to DataAccess in Presenter?
An error occurs only when there are two single parameter constructors. The error goes when I have the following constructors:
public CustomerBusiness(ICustomerDataAccess data, string language) { _data = data; } public CustomerBusiness(string language): this(new CustomerDataAccess("language")) {}
source share