Пример #1
0
        /// <summary>
        /// Delete using the expression.
        /// e.g. entity.LogLevel == 1
        /// </summary>
        /// <param name="expression">Expression to use for deletion.</param>
        public virtual void Delete(Expression <Func <T, bool> > expression)
        {
            string filter = RepositoryExpressionHelper.BuildSinglePropertyCondition <T>(expression);
            string sql    = string.Format("delete from {0} where {1}", TableName, filter);

            _db.ExecuteNonQueryText(sql, null);
        }
Пример #2
0
        /// <summary>
        /// Delete using the expression.
        /// e.g. entity.LogLevel == 1
        /// </summary>
        /// <param name="expression">Expression to use for deletion.</param>
        public override void Delete(Expression <Func <T, bool> > expression)
        {
            string filter = RepositoryExpressionHelper.BuildSinglePropertyCondition <T>(expression);

            DataRow[] rows = _table.Select(filter);
            foreach (var row in rows)
            {
                _table.Rows.Remove(row);
            }
        }