示例#1
0
        public IEnumerable <T> GetAll()
        {
            IEnumerable <T> listOfEntities;

            using (var dbContext = new MobilesDbContext())
            {
                listOfEntities = dbContext.Set <T>().ToList();
            }
            return(listOfEntities);
        }
示例#2
0
        public T Get(int id)
        {
            T entity;

            using (var dbContext = new MobilesDbContext())
            {
                entity = dbContext.Set <T>().Find(id);
            }
            return(entity);
        }