I read a lot about the implementions of the unit of work pattern e.g http://www.asp.net/mvc/tutorials/getting-started-with-ef-5-using-mvc-4/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application or http://gaui.is/how-to-mock-the-datacontext-linq/
They keep a generic base repository class or interface in the unit of work class which works quite well. In practice my repositories need more functionality as the generic interface repository provides.
So my goal is to use custom repositories if neccessary. But I'm not sure how to implement them. I don't want to define them in the unit of work class as seen below,
public class UnitOfWork : IDisposable
{
private SchoolContext context = new SchoolContext();
private CustomRepository<Department> departmentRepository;
private GenericRepository<Course> courseRepository;
[...]
because I will not able to use the UnitOfWork class again. I think the sample code above contradicts the UnitofWork pattern.
Does someone have an idea how to implement a custom repository in a clean way in the unit of work pattern when I build something similar to http://gaui.is/how-to-mock-the-datacontext-linq/ ?
best regards