Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Common / EntitySql / AST / DotExpr.cs / 1305376 / DotExpr.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
namespace System.Data.Common.EntitySql.AST
{
using System;
using System.Globalization;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
///
/// Represents dotExpr: expr.Identifier
///
internal sealed class DotExpr : Node
{
private readonly Node _leftExpr;
private readonly Identifier _identifier;
private bool? _isMultipartIdentifierComputed;
private string[] _names;
///
/// initializes
///
internal DotExpr(Node leftExpr, Identifier id)
{
_leftExpr = leftExpr;
_identifier = id;
}
///
/// For the following expression: "a.b.c.d", Left returns "a.b.c".
///
internal Node Left
{
get { return _leftExpr; }
}
///
/// For the following expression: "a.b.c.d", Identifier returns "d".
///
internal Identifier Identifier
{
get { return _identifier; }
}
///
/// Returns true if all parts of this expression are identifiers like in "a.b.c",
/// false for expressions like "FunctionCall().a.b.c".
///
internal bool IsMultipartIdentifier(out string[] names)
{
if (_isMultipartIdentifierComputed.HasValue)
{
names = _names;
return _isMultipartIdentifierComputed.Value;
}
_names = null;
Identifier leftIdenitifier = _leftExpr as Identifier;
if (leftIdenitifier != null)
{
_names = new string[] { leftIdenitifier.Name, _identifier.Name };
}
DotExpr leftDotExpr = _leftExpr as DotExpr;
string[] leftNames;
if (leftDotExpr != null && leftDotExpr.IsMultipartIdentifier(out leftNames))
{
_names = new string[leftNames.Length + 1];
leftNames.CopyTo(_names, 0);
_names[_names.Length - 1] = _identifier.Name;
}
Debug.Assert(_names == null || _names.Length > 0, "_names must be null or non-empty");
_isMultipartIdentifierComputed = _names != null;
names = _names;
return _isMultipartIdentifierComputed.Value;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
namespace System.Data.Common.EntitySql.AST
{
using System;
using System.Globalization;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
///
/// Represents dotExpr: expr.Identifier
///
internal sealed class DotExpr : Node
{
private readonly Node _leftExpr;
private readonly Identifier _identifier;
private bool? _isMultipartIdentifierComputed;
private string[] _names;
///
/// initializes
///
internal DotExpr(Node leftExpr, Identifier id)
{
_leftExpr = leftExpr;
_identifier = id;
}
///
/// For the following expression: "a.b.c.d", Left returns "a.b.c".
///
internal Node Left
{
get { return _leftExpr; }
}
///
/// For the following expression: "a.b.c.d", Identifier returns "d".
///
internal Identifier Identifier
{
get { return _identifier; }
}
///
/// Returns true if all parts of this expression are identifiers like in "a.b.c",
/// false for expressions like "FunctionCall().a.b.c".
///
internal bool IsMultipartIdentifier(out string[] names)
{
if (_isMultipartIdentifierComputed.HasValue)
{
names = _names;
return _isMultipartIdentifierComputed.Value;
}
_names = null;
Identifier leftIdenitifier = _leftExpr as Identifier;
if (leftIdenitifier != null)
{
_names = new string[] { leftIdenitifier.Name, _identifier.Name };
}
DotExpr leftDotExpr = _leftExpr as DotExpr;
string[] leftNames;
if (leftDotExpr != null && leftDotExpr.IsMultipartIdentifier(out leftNames))
{
_names = new string[leftNames.Length + 1];
leftNames.CopyTo(_names, 0);
_names[_names.Length - 1] = _identifier.Name;
}
Debug.Assert(_names == null || _names.Length > 0, "_names must be null or non-empty");
_isMultipartIdentifierComputed = _names != null;
names = _names;
return _isMultipartIdentifierComputed.Value;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CodeGeneratorOptions.cs
- ErrorEventArgs.cs
- cookiecontainer.cs
- GeometryModel3D.cs
- SystemException.cs
- Buffer.cs
- ProviderBase.cs
- ClientSession.cs
- WebPageTraceListener.cs
- FilteredXmlReader.cs
- ObjectConverter.cs
- ExpressionEditorSheet.cs
- IPEndPoint.cs
- WsatServiceCertificate.cs
- CheckBoxStandardAdapter.cs
- XmlQuerySequence.cs
- XmlnsDictionary.cs
- TextTreeInsertElementUndoUnit.cs
- SafeNativeMethods.cs
- DataServiceExpressionVisitor.cs
- DataServiceQueryException.cs
- ResXFileRef.cs
- DataColumnCollection.cs
- ExtendedProtectionPolicy.cs
- ArgumentsParser.cs
- ICspAsymmetricAlgorithm.cs
- InvalidComObjectException.cs
- HelpInfo.cs
- SigningDialog.cs
- HtmlInputReset.cs
- ProfileParameter.cs
- WaitHandleCannotBeOpenedException.cs
- SecurityState.cs
- RegexCaptureCollection.cs
- StringFormat.cs
- BmpBitmapDecoder.cs
- WindowsGraphicsCacheManager.cs
- ToolStripGrip.cs
- WorkItem.cs
- Canonicalizers.cs
- ArgumentOutOfRangeException.cs
- HierarchicalDataTemplate.cs
- SymbolType.cs
- WebEventTraceProvider.cs
- IISMapPath.cs
- DataServiceRequestOfT.cs
- XmlSchemaInfo.cs
- Menu.cs
- PlaceHolder.cs
- SqlDuplicator.cs
- Ray3DHitTestResult.cs
- namescope.cs
- X509ServiceCertificateAuthentication.cs
- MsmqInputChannelListener.cs
- TriState.cs
- XmlSchemaSimpleContentExtension.cs
- RequestCacheValidator.cs
- PanelStyle.cs
- Facet.cs
- DataRecord.cs
- IgnoreDeviceFilterElement.cs
- SimpleWebHandlerParser.cs
- FontEmbeddingManager.cs
- BitmapEffectInput.cs
- DoubleAnimationBase.cs
- FileDialog.cs
- HelloOperationAsyncResult.cs
- Wizard.cs
- AssociationType.cs
- HttpVersion.cs
- SvcFileManager.cs
- AvTrace.cs
- DataGridViewMethods.cs
- ContextMenu.cs
- HebrewCalendar.cs
- Triplet.cs
- WorkflowRuntimeServiceElementCollection.cs
- WebPartVerbCollection.cs
- TextMarkerSource.cs
- MSAAWinEventWrap.cs
- ImageDrawing.cs
- XmlName.cs
- TrustManagerMoreInformation.cs
- ExpressionHelper.cs
- HScrollProperties.cs
- clipboard.cs
- xml.cs
- MatrixUtil.cs
- NetMsmqBindingCollectionElement.cs
- _Win32.cs
- RightsManagementInformation.cs
- TextBox.cs
- FacetDescription.cs
- CharacterBufferReference.cs
- TextTreeNode.cs
- XmlParserContext.cs
- MexNamedPipeBindingElement.cs
- FunctionOverloadResolver.cs
- DbDeleteCommandTree.cs
- WorkflowDesignerMessageFilter.cs