Hallo,
Why do I need 2 classes to get my data? Why is a DataProvider class not enough, if the Service does actually nothing except call the method in the DataProvider ?
interface ICustomerDataProvider
inferface ICustomerService
class CustomerDataProvider : ICustomerDataProvider
{
// Do Sql queries here
// return sql data and write all DataReader data into customer objects....
public IEnumerable<Customer> GetCustomers()
{
return ...
}
}
class CustomerService : ICustomerService
{
public IEnumerable<Customer> GetCustomers()
{
return _customerDataProvider.GetCustomers();
}
}
class BillingViewModel
{
_customerService = Service.Resolve<ICustomer>();
IEnumerable<Customer> customers = _customerService.GetCustomers();
Customers = new ObservableCollection<Customer>(customers);
}