示例#1
0
        public override Statement CreateStatement(DatabaseMapper mapper)
        {
            var delete = new DeleteStatement();

            delete.Target = new Table(mapper.GetTableName(this.Target));
            foreach (var condition in StatementCreator.VisitStatementConditions(this.Conditions, mapper, false))
            {
                delete.Conditions.Add(condition);
            }
            return(delete);
        }
示例#2
0
        //public static Delete<T> From<T>()
        //{
        //	return new Delete<T>();
        //}

        public static DeleteStatement Where(this DeleteStatement delete, bool all)
        {
            if (all)
            {
                var newCondition = new Condition();
                newCondition.Field = new ConstantPart(true);
                newCondition.Value = new ConstantPart(true);
                delete.Conditions.Add(newCondition);
            }
            return(delete);
        }
示例#3
0
 public static DeleteStatement Where(this DeleteStatement delete, string columnName, SqlOperator op, object value)
 {
     delete.Conditions.Add(new Condition(columnName, op, value));
     return(delete);
 }
示例#4
0
 /// <summary>
 /// Adds a condition to the delete statement.
 /// </summary>
 /// <typeparam name="T">The type corresponding to the table that records should be deleted from.</typeparam>
 /// <param name="delete">The delete statement.</param>
 /// <param name="condition">The condition.</param>
 /// <returns>The delete statement.</returns>
 public static DeleteStatement <T> Where <T>(this DeleteStatement <T> delete, Expression <Func <T, bool> > condition)
 {
     delete.Conditions = condition;
     return(delete);
 }