Question to UnitOfWork Implementation

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
Posts: 17
Joined: Thu 29 Jun 2017 11:07

Question to UnitOfWork Implementation

Post by PixelHunter » Mon 31 Jul 2017 17:33

After many hours of training and analysis I get an better idea how your tool and the generated code works.
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()
To make it easy to access the repositories like

Code: Select all

this.customerBindingSource.DataSource = _unitOfWork.Customer.GetCustomerAll();
How does it is possible or meant in the generated code from the UnitOfWork template?

Please give me an example.

Site Admin
Posts: 8863
Joined: Thu 14 Aug 2008 12:44

Re: Question to UnitOfWork Implementation

Post by Shalex » Thu 03 Aug 2017 13:15

Simple walkthrough with the RepositoryAndUnitOfWork template: viewtopic.php?t=24678#p85646.
Be aware about viewtopic.php?f=32&t=29479.
If this doesn't help, please specify the exact issue you have encountered (error with its stack trace, steps for reproducing, etc).

Post Reply