I'm using the next tutorial to use the Repository Pattern:
Follow my repository class
public class Repository<T> : IDisposable, IRepository<T> where T : class
{
protected readonly EntityContext ctx;
public Repository(EntityContext _ctx)
{
this.ctx = _ctx;
}
public T getByID(object id)
{
return ctx.Set<T>().Find(id);
}
}
But at the time of creating the GetByID(int id)
method, the error below is popping up.
DbSet does not contain a definition for 'Find' and in the extension method 'Find' accepting the first argument of type '
DbSet<T>
' could be found (are you missing a directive or an assembly reference?)
In the tutorial I'm following, the instructor teaches the same way I showed here.