Example #1
0
        /// <summary>
        /// 根据条件 删除实体
        /// </summary>
        /// <param name="doWhere"></param>
        /// <returns></returns>
        public int DelBySqlWhere(Expression <Func <T, bool> > doWhere)
        {
            try
            {
                int iret = -1;

                using (DbContext _dbx = new Model.Entities())
                {
                    iret = BatchExtensions.Delete(_dbx.Set <T>().Where(doWhere));
                }
                return(iret);
            }
            catch (Exception ex)
            {
                RecordLog.RecordWarn(ex.ToString());
                throw ex;
            }
        }
 public virtual void DeleteAll()
 {
     BatchExtensions.Delete <TEntity>(this.DbSet);
 }
 public virtual void BatchDelete(Expression <Func <TEntity, bool> > predicate)
 {
     BatchExtensions.Delete <TEntity>(this.DbSet.Where(predicate));
 }