1 //---------------------------------------------------------------------
2 // <copyright file="DbSetClause.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
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;
16 using System.Diagnostics;
18 namespace System.Data.Common.CommandTrees
21 /// Specifies a clause in a modification operation setting the value of a property.
23 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db")]
24 public sealed class DbSetClause : DbModificationClause
26 private DbExpression _prop;
27 private DbExpression _val;
29 internal DbSetClause(DbExpression targetProperty, DbExpression sourceValue)
32 EntityUtil.CheckArgumentNull(targetProperty, "targetProperty");
33 EntityUtil.CheckArgumentNull(sourceValue, "sourceValue");
34 _prop = targetProperty;
39 /// Gets an <see cref="DbExpression"/> that specifies the property that should be updated.
42 /// Constrained to be a <see cref="DbPropertyExpression"/>.
44 public DbExpression Property
53 /// Gets an <see cref="DbExpression"/> that specifies the new value with which to update the property.
56 /// Constrained to be a <see cref="DbConstantExpression"/> or <see cref="DbNullExpression"/>
58 public DbExpression Value
66 internal override void DumpStructure(ExpressionDumper dumper)
68 dumper.Begin("DbSetClause");
69 if (null != this.Property)
71 dumper.Dump(this.Property, "Property");
73 if (null != this.Value)
75 dumper.Dump(this.Value, "Value");
77 dumper.End("DbSetClause");
80 internal override TreeNode Print(DbExpressionVisitor<TreeNode> visitor)
82 TreeNode node = new TreeNode("DbSetClause");
83 if (null != this.Property)
85 node.Children.Add(new TreeNode("Property", this.Property.Accept(visitor)));
87 if (null != this.Value)
89 node.Children.Add(new TreeNode("Value", this.Value.Accept(visitor)));