I really miss some working sample projects and source code, this would make things easier for me.
Here is my question:
I learned that the UnitOfWork implementation should contain the repositories of each entities.
Code: Select all
public class UnitOfWork : IUnitOfWork
{
private readonly Context _context;
public ICustomerRepository Customer { get; private set; }
public ISalesRepository Sales { get; private set; }
public UnitOfWork(Context context)
{
_context = context;
Customer = new CustomerRepository(_context);
Sales = new SalesRepository(_context);
}
public int Complete()
{
return _context.SaveChanges();
}
public void Dispose()
{
_context.Dispose();
}
}
Code: Select all
this.customerBindingSource.DataSource = _unitOfWork.Customer.GetCustomerAll();
Please give me an example.