Using code below:
public IGenericRepository<TEntity> Repository<TEntity>() where TEntity : class
{
if (repositories.Keys.Contains(typeof(TEntity)) == true)
{
return repositories[typeof(TEntity)] as IGenericRepository<TEntity>;
}
IGenericRepository<TEntity> repo = new GenericRepository<TEntity>(_context);
repositories.Add(typeof(TEntity), repo);
return repo;
}
The Error I got,
Error 1 Inconsistent accessibility: return type 'DataModel.GenericRepository.IGenericRepository' is less accessible than method 'DataModel.UnitOfWork.UnitOfWork.Repository()' C:\Users\Anoop.k\documents\visual studio 2013\Projects\WebAPI\DataModel\UnitOfWork\UnitOfWork.cs 30 44 DataModel
I know that IGenericRepository repo is private by default. But in this sort of situation what to do? Please help me.