Implementing IRepository in IUnitOfWork

1

Hi, how can my UoF interface inherit from IRepository? having this:

public interface IRepository<T> where T : class, IDisposable

IoW

public interface IUnitOfWork : IRepository
{
    int Save();
}
    
asked by Pedro Ávila 01.04.2016 в 18:00
source

1 answer

1

You could define the T of generic also in the class UoW

public interface IRepository<T> : IDisposable where T : class 
{
}

public interface IUnitOfWork<T> : IRepository<T> where T : class
{
   int Save(T entity);
}

I would also recommend you analyze examples like being

Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application (9 of 10)

in the title Creating the Unit of Work Class you could see that the UoW class does not inherit from any repository

    
answered by 01.04.2016 / 19:11
source