1 //---------------------------------------------------------------------
2 // <copyright file="DbDeleteCommandTree.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
6 // @owner Microsoft, Microsoft
7 // @backupOwner Microsoft
8 //---------------------------------------------------------------------
11 using System
.Collections
.Generic
;
13 using System
.Data
.Metadata
.Edm
;
14 using System
.Data
.Common
.CommandTrees
.Internal
;
15 using System
.Data
.Common
.Utils
;
17 namespace System
.Data
.Common
.CommandTrees
20 /// Represents a single row delete operation expressed as a canonical command tree.
22 [System
.Diagnostics
.CodeAnalysis
.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId
= "Db")]
23 public sealed class DbDeleteCommandTree
: DbModificationCommandTree
25 private readonly DbExpression _predicate
;
27 internal DbDeleteCommandTree(MetadataWorkspace metadata
, DataSpace dataSpace
, DbExpressionBinding target
, DbExpression predicate
)
28 : base(metadata
, dataSpace
, target
)
30 EntityUtil
.CheckArgumentNull(predicate
, "predicate");
32 this._predicate
= predicate
;
36 /// Gets an <see cref="DbExpression"/> that specifies the predicate used to determine which members of the target collection should be deleted.
39 /// The predicate can include only the following elements:
41 /// <item>Equality expression</item>
42 /// <item>Constant expression</item>
43 /// <item>IsNull expression</item>
44 /// <item>Property expression</item>
45 /// <item>Reference expression to the target</item>
46 /// <item>And expression</item>
47 /// <item>Or expression</item>
48 /// <item>Not expression</item>
51 public DbExpression Predicate
59 internal override DbCommandTreeKind CommandTreeKind
61 get { return DbCommandTreeKind.Delete; }
64 internal override bool HasReader
68 // a delete command never returns server-gen values, and
69 // therefore never returns a reader
74 internal override void DumpStructure(ExpressionDumper dumper
)
76 base.DumpStructure(dumper
);
78 if (this.Predicate
!= null)
80 dumper
.Dump(this.Predicate
, "Predicate");
84 internal override string PrintTree(ExpressionPrinter printer
)
86 return printer
.Print(this);