1 //---------------------------------------------------------------------
2 // <copyright file="CommandPlan.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
7 // @backupOwner Microsoft
8 //---------------------------------------------------------------------
11 using System
.Collections
.Generic
;
12 using System
.Globalization
;
13 using System
.Data
.Common
;
14 using md
= System
.Data
.Metadata
.Edm
;
15 using cqt
= System
.Data
.Common
.CommandTrees
;
16 //using System.Diagnostics; // Please use PlanCompiler.Assert instead of Debug.Assert in this class...
18 // It is fine to use Debug.Assert in cases where you assert an obvious thing that is supposed
19 // to prevent from simple mistakes during development (e.g. method argument validation
20 // in cases where it was you who created the variables or the variables had already been validated or
21 // in "else" clauses where due to code changes (e.g. adding a new value to an enum type) the default
22 // "else" block is chosen why the new condition should be treated separately). This kind of asserts are
23 // (can be) helpful when developing new code to avoid simple mistakes but have no or little value in
24 // the shipped product.
25 // PlanCompiler.Assert *MUST* be used to verify conditions in the trees. These would be assumptions
26 // about how the tree was built etc. - in these cases we probably want to throw an exception (this is
27 // what PlanCompiler.Assert does when the condition is not met) if either the assumption is not correct
28 // or the tree was built/rewritten not the way we thought it was.
29 // Use your judgment - if you rather remove an assert than ship it use Debug.Assert otherwise use
30 // PlanCompiler.Assert.
34 // A CommandPlan represents the plan for a query.
36 namespace System
.Data
.Query
.PlanCompiler
41 /// Captures information about a single provider command
43 internal sealed class ProviderCommandInfo
48 /// Internal methods to get the command tree
50 internal cqt
.DbCommandTree CommandTree
52 get { return _commandTree; }
57 private cqt
.DbCommandTree _commandTree
;
58 private ProviderCommandInfo _parent
;
59 private List
<ProviderCommandInfo
> _children
;
65 /// Internal constructor for a ProviderCommandInfo object
67 /// <param name="commandTree">command tree for the provider command</param>
68 /// <param name="children">children command infos</param>
69 internal ProviderCommandInfo(cqt
.DbCommandTree commandTree
,
70 List
<ProviderCommandInfo
> children
)
72 _commandTree
= commandTree
;
75 if (_children
== null)
77 _children
= new List
<ProviderCommandInfo
>();
80 foreach (ProviderCommandInfo child
in _children
)