Example #1
0
 public GenericRepo()
 {
     _context = new ProjectDataEntities();
     dbentity = _context.Set <T>();
 }
        private IDbSet <T> dbentity;                                 //An IDbSet<TEntity> represents the collection of all entities in the context, or that can be queried from the database, of a given type. DbSet<TEntity> is a concrete implementation of IDbSet.

        public GenericRepo()                                         //Constructor of GenericRepo class to initiate the dbentity object of IDbset<T>, so that we use the methods of IDbSet<T> class with the object
        {
            _context = new ProjectDataEntities();
            dbentity = _context.Set <T>();
        }