public virtual void Remove(T p) { using (var bll = new BaseDal()) { bll.Set <T>().Attach(p); bll.Set <T>().Remove(p); bll.SaveChanges(); } }
//public void ExecuteNonQuery(string sql) //{ // using (var dal = new BaseDal()) // { // dal.Database.ExecuteNonQuery(sql); // } //} public void Clear() { using (var dal = new BaseDal()) { var list = (from o in dal.Set <T>() select o).ToList(); dal.Set <T>().RemoveRange(list); dal.SaveChanges(); } }
public virtual IList <T> Query() { using (var bll = new BaseDal()) { return((from o in bll.Set <T>() select o).AsNoTracking().ToList()); } }
public T Find(params object[] p) { using (var bll = new BaseDal()) { return(bll.Set <T>().Find(p)); } }
public virtual void Add(T p) { using (var bll = new BaseDal()) { bll.Set <T>().Add(p); bll.SaveChanges(); } }