Beispiel #1
0
        /// <summary>
        /// 删除一个实体
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Delete <T>(Table table, T entity)
            where T : Entity
        {
            WhereClip where = DataUtils.GetPkWhere <T>(table, entity);
            int val = 0;

            if (useBatch)
            {
                DbCommand cmd = dbProvider.CreateDelete <T>(table, where);
                AddCommand(cmd);
            }
            else
            {
                val = dbProvider.Delete <T>(table, where, dbTrans);
            }
            return(val);
        }