Updates referencesource to .NET 4.7
[mono-project.git] / mcs / class / referencesource / System.Data.Entity / System / Data / Query / PlanCompiler / CommandPlan.cs
blobafafe61883611b4beff48fd970cf9bdee9295930
1 //---------------------------------------------------------------------
2 // <copyright file="CommandPlan.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
4 // </copyright>
5 //
6 // @owner Microsoft
7 // @backupOwner Microsoft
8 //---------------------------------------------------------------------
10 using System;
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
38 #region CommandInfo
40 /// <summary>
41 /// Captures information about a single provider command
42 /// </summary>
43 internal sealed class ProviderCommandInfo
45 #region public apis
47 /// <summary>
48 /// Internal methods to get the command tree
49 /// </summary>
50 internal cqt.DbCommandTree CommandTree
52 get { return _commandTree; }
54 #endregion
56 #region private state
57 private cqt.DbCommandTree _commandTree;
58 private ProviderCommandInfo _parent;
59 private List<ProviderCommandInfo> _children;
60 #endregion
62 #region constructors
64 /// <summary>
65 /// Internal constructor for a ProviderCommandInfo object
66 /// </summary>
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;
73 _children = children;
75 if (_children == null)
77 _children = new List<ProviderCommandInfo>();
80 foreach (ProviderCommandInfo child in _children)
82 child._parent = this;
85 #endregion
88 #endregion