8ad476f8713ecbe8d8ce2c19766218fa61b17312
[mono.git] / mcs / class / referencesource / System.Data.Entity / System / Data / Mapping / ViewGeneration / Structures / QualifiedCellIdBoolean.cs
1 //---------------------------------------------------------------------
2 // <copyright file="QualifiedCellIdBoolean.cs" company="Microsoft">
3 //      Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 //
6 // @owner Microsoft
7 // @backupOwner Microsoft
8 //---------------------------------------------------------------------
9
10 using System.Data.Common.CommandTrees;
11 using System.Data.Mapping.ViewGeneration.CqlGeneration;
12 using System.Diagnostics;
13 using System.Text;
14
15 namespace System.Data.Mapping.ViewGeneration.Structures
16 {
17     /// <summary>
18     /// A class that denotes "block_alias.booleanVar", e.g., "T1._from2".
19     /// It is a subclass of <see cref="CellIdBoolean"/> with an added block alias.
20     /// </summary>
21     internal sealed class QualifiedCellIdBoolean : CellIdBoolean
22     {
23         #region Constructor
24         /// <summary>
25         /// Creates a boolean of the form "<paramref name="block"/>.<paramref name="originalCellNum"/>".
26         /// </summary>
27         internal QualifiedCellIdBoolean(CqlBlock block, CqlIdentifiers identifiers, int originalCellNum)
28             : base(identifiers, originalCellNum)
29         {
30             m_block = block;
31         }
32         #endregion
33
34         #region Fields
35         private readonly CqlBlock m_block;
36         #endregion
37
38         #region Methods
39         internal override StringBuilder AsEsql(StringBuilder builder, string blockAlias, bool skipIsNotNull)
40         {
41             // QualifiedCellIdBoolean is only used during JOIN processing where there is no single input, hence blockAlias is expected to be null.
42             Debug.Assert(blockAlias == null, "QualifiedCellIdBoolean: blockAlias mismatch");
43             return base.AsEsql(builder, m_block.CqlAlias, skipIsNotNull);
44         }
45
46         internal override DbExpression AsCqt(DbExpression row, bool skipIsNotNull)
47         {
48             return base.AsCqt(m_block.GetInput(row), skipIsNotNull);
49         }
50         #endregion
51     }
52 }