Example #1
0
        //public EnrollmentsController() : this (new GenericRepo<Enrollment>())
        //{

        //}

        public EnrollmentsController(_IGenericRepo <Enrollment> Eobj)
        {
            dbentity = new ProjectDataEntities();
            _Eobj    = Eobj;
        }
        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>();
        }
Example #3
0
 public GenericRepo()
 {
     _context = new ProjectDataEntities();
     dbentity = _context.Set <T>();
 }
        private ProjectDataEntities _context;  //declare the object of the database to get access the members of Course and Student table.

        public EnrollmentsController()
        {
            Eobj     = new GenericRepo <Enrollment>();
            _context = new ProjectDataEntities();
        }