I have this setup and get a compiler warning "... hides inherited member ...". How do I fix?
public interface IRepository<T> where T : class { IQueryable<T> GetAll(); T GetById(int id); } public class EFRepository<T> : IRepository<T> where T : class { public EFRepository(DbContext dbContext) { if (dbContext == null) throw new ArgumentNullException("dbContext"); DbContext = dbContext; DbSet = DbContext.Set<T>(); } protected DbContext DbContext { get; set; } protected DbSet<T> DbSet { get; set; } public virtual IQueryable<T> GetAll() { return DbSet; } public virtual T GetById(int id) { return DbSet.Find(id); } } public interface IProductRepository : IRepository<Product> { // Product specific interface code here } public class ProductRepository : EFRepository<Product>, IProductRepository { public ProductRepository(DbContext context) : base(context) { } public IQueryable<Product> GetAll() { return DbSet.Include("Table1").Include("Table2").AsQueryable(); } } I get the compiler warning message but when running application, I get a StackOverflowException error. Adding the new keyword still generates the StackOverflowException error. Override keyword doesn't work. If I comment out the ProductRepository GetAll() method, all is fine and dandy. But I need to override the GetAll() method.
Thanks.
newkeyword, not override.