0

I was wondering how DbSet actually sets itself.

If you see the definition of DbSet, it is a concrete class.

But all the methods are not implemented making it looks more like interface.

public class DbSet<TEntity> : DbQuery<TEntity>,
                              IDbSet<TEntity>, 
                              IQueryable<TEntity>, 
                              IEnumerable<TEntity>, 
                              IQueryable, 
                              IEnumerable, 
                              IInternalSetAdapter where TEntity : class

...

 public virtual TEntity Add(TEntity entity);

I see that DbSet class has a base class and many interfaces. but none of them actually implements the methods like Add and It doesn't have members that holds the DbContext

I was wondering what's going on.

So on this subject, initial questions will be..

  • Where does the DbSet methods get implemented?

  • No in-memory storage(?) for DbSet?

Thank you for everyone for your insights.

Masoud
  • 8,020
  • 12
  • 62
  • 123
CodeSchool JJ
  • 585
  • 5
  • 16

0 Answers0