public List <T> GetAll() { using (ShoppingMallEntities context = new ShoppingMallEntities()) { return(context.Set <T>().ToList()); } }
public List <S> Select <S>(Expression <Func <T, S> > selector) { using (ShoppingMallEntities context = new ShoppingMallEntities()) { return(context.Set <T>().Select(selector).ToList()); } }
public void Insert(T entity) { using (ShoppingMallEntities context = new ShoppingMallEntities()) { context.Set <T>().Add(entity); context.SaveChanges(); } }