I was trying to implement a generic repository, and I have this right now:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Da
You will need to change your method to look like this:
public GenericRepository(ApplicationDbContext _entities)
{
entities = _entities;
_objectSet = entities.Set<T>(); //This line changed.
}
This should have the function that you desire.
The .Set<T>()
is the generic method that returns the DbSet
of the type used.
UPDATE:
With the change in return type you will need to change your _objectSet
type as well.
DbSet<T> _objectSet;