1 //---------------------------------------------------------------------
2 // <copyright file="DbModificationCommandTree.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;
18 namespace System.Data.Common.CommandTrees
21 /// Represents a DML operation expressed as a canonical command tree
23 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db")]
24 public abstract class DbModificationCommandTree : DbCommandTree
26 private readonly DbExpressionBinding _target;
27 private System.Collections.ObjectModel.ReadOnlyCollection<DbParameterReferenceExpression> _parameters;
29 internal DbModificationCommandTree(MetadataWorkspace metadata, DataSpace dataSpace, DbExpressionBinding target)
30 : base(metadata, dataSpace)
32 EntityUtil.CheckArgumentNull(target, "target");
34 this._target = target;
38 /// Gets the <see cref="DbExpressionBinding"/> that specifies the target table for the DML operation.
40 public DbExpressionBinding Target
49 /// Returns true if this modification command returns a reader (for instance, to return server generated values)
51 internal abstract bool HasReader
56 internal override IEnumerable<KeyValuePair<string, TypeUsage>> GetParameters()
58 if (this._parameters == null)
60 this._parameters = ParameterRetriever.GetParameters(this);
62 return this._parameters.Select(p => new KeyValuePair<string, TypeUsage>(p.ParameterName, p.ResultType));
65 internal override void DumpStructure(ExpressionDumper dumper)
67 if (this.Target != null)
69 dumper.Dump(this.Target, "Target");