Search code examples
c#unit-of-workgeneric-interface

IGenericRepository<T> - Cannot resolve symbol where


I'm following a tutorial on the unit of work pattern and my code won't compile because it doesn't recognise where in the interface signature and it doesn't recognise type T.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace DataLayer.Repository
{
   public interface IGenericRepository<T> : where T : class
{
    IQueryable<T> AsQueryable();

    IEnumerable<T> GetAll();
    IEnumerable<T> Find(Expression<Func<T, bool>> predicate);
    T Single(Expression<Func<T, bool>>  predicate);
    T SingleOrDefault(Expression<Func<T, bool>> predicate);
    T First(Expression<Func<T, bool>> predicate);
    T GetById(int id);

    void Add(T entity);
    void Delete(T entity);
    void Attach(T entity);
}
}

Can anyone see what I'm missing?


Solution

  • Please remove the extra :, like this:

    public interface IGenericRepository<T> where T : class