I see from many examples when making repositories in asp.net core using entityframeworkcore that it is common to write constructors something like this:
private readonly ApplicationDbContext _context;
private readonly DbSet<Project> dbSet;
public ProjectRepository(ApplicationDbContext context)
{
_context = context;
dbSet = context.Set<Project>();
}Now this is how I wrote mine. I'm not sure if I need to pass in both the general context as well as a dbSet of type T. But I use the context just in case I need to get other types than the Project table.
What is the advantages of using a dbSet, and what is it? Is it just a holder for a query, but in that case why not just use the context like normal? Is it to enforce the repository to only be able to make queries to that type?