Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / Common / EntitySql / DotExpr.cs / 1 / DotExpr.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @bacukp [....] //--------------------------------------------------------------------- namespace System.Data.Common.EntitySql { using System; using System.Globalization; using System.Collections; using System.Collections.Generic; ////// represents dotExpr (expr)+.Identifier /// internal sealed class DotExpr : Expr #if EXTRA_ENTITYSQL_PARSER_DEBUGGING , IEnumerable#endif { private Expr _leftExpr; private Identifier _identifier; private bool _wasDotIdComputed; private bool _isDottedIdentifier; private string[] _identifierNames; private string _fullName; private int _length; private Expr _leftmostExpr; /// /// initializes /// /// /// internal DotExpr( Expr expr, Identifier id ) { _leftExpr = expr; _identifier = id; } internal Expr Left { get { return _leftExpr; } } internal Identifier Identifier { get { return _identifier; } } internal bool IsDottedIdentifier { get { CheckIfDotIdentifier(); return _isDottedIdentifier; } } internal int Length { get { CheckIfDotIdentifier(); return _length; } } internal string[] Names { get { CheckIfDotIdentifier(); return _identifierNames; } } internal string FullName { get { CheckIfDotIdentifier(); return _fullName; } } internal Expr LeftMostExpression { get { CheckIfDotIdentifier(); return _leftmostExpr; } } // // Delay computation and cache results // private void CheckIfDotIdentifier() { if (_wasDotIdComputed) { return; } _wasDotIdComputed = true; // // Get number of 'elements' // _length = 0; _isDottedIdentifier = false; Expr expr = this; while (expr is DotExpr) { _length++; expr = ((DotExpr)expr).Left; } if (expr is Identifier) { _isDottedIdentifier = true; _length++; } else { _leftmostExpr = expr; } _identifierNames = new string[_length]; int i = _length - 1; expr = this; while (expr is DotExpr) { DotExpr dotExpr = (DotExpr)expr; _identifierNames[i--] = dotExpr.Identifier.Name; expr = dotExpr.Left; } if (null == _leftmostExpr && null != expr) { _identifierNames[i] = ((Identifier)expr).Name; } _fullName = String.Join(".", _identifierNames); } #if EXTRA_ENTITYSQL_PARSER_DEBUGGING #region GetEnumerator public IEnumeratorGetEnumerator() { Expr _expr = this; while (_expr is DotExpr) { yield return _expr; _expr = ((DotExpr)_expr).Left; } } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return GetEnumerator(); } #endregion #endif } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @bacukp [....] //--------------------------------------------------------------------- namespace System.Data.Common.EntitySql { using System; using System.Globalization; using System.Collections; using System.Collections.Generic; ////// represents dotExpr (expr)+.Identifier /// internal sealed class DotExpr : Expr #if EXTRA_ENTITYSQL_PARSER_DEBUGGING , IEnumerable#endif { private Expr _leftExpr; private Identifier _identifier; private bool _wasDotIdComputed; private bool _isDottedIdentifier; private string[] _identifierNames; private string _fullName; private int _length; private Expr _leftmostExpr; /// /// initializes /// /// /// internal DotExpr( Expr expr, Identifier id ) { _leftExpr = expr; _identifier = id; } internal Expr Left { get { return _leftExpr; } } internal Identifier Identifier { get { return _identifier; } } internal bool IsDottedIdentifier { get { CheckIfDotIdentifier(); return _isDottedIdentifier; } } internal int Length { get { CheckIfDotIdentifier(); return _length; } } internal string[] Names { get { CheckIfDotIdentifier(); return _identifierNames; } } internal string FullName { get { CheckIfDotIdentifier(); return _fullName; } } internal Expr LeftMostExpression { get { CheckIfDotIdentifier(); return _leftmostExpr; } } // // Delay computation and cache results // private void CheckIfDotIdentifier() { if (_wasDotIdComputed) { return; } _wasDotIdComputed = true; // // Get number of 'elements' // _length = 0; _isDottedIdentifier = false; Expr expr = this; while (expr is DotExpr) { _length++; expr = ((DotExpr)expr).Left; } if (expr is Identifier) { _isDottedIdentifier = true; _length++; } else { _leftmostExpr = expr; } _identifierNames = new string[_length]; int i = _length - 1; expr = this; while (expr is DotExpr) { DotExpr dotExpr = (DotExpr)expr; _identifierNames[i--] = dotExpr.Identifier.Name; expr = dotExpr.Left; } if (null == _leftmostExpr && null != expr) { _identifierNames[i] = ((Identifier)expr).Name; } _fullName = String.Join(".", _identifierNames); } #if EXTRA_ENTITYSQL_PARSER_DEBUGGING #region GetEnumerator public IEnumeratorGetEnumerator() { Expr _expr = this; while (_expr is DotExpr) { yield return _expr; _expr = ((DotExpr)_expr).Left; } } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return GetEnumerator(); } #endregion #endif } } // 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
- MouseWheelEventArgs.cs
- QueryPageSettingsEventArgs.cs
- WindowsStartMenu.cs
- Permission.cs
- InternalResources.cs
- XmlStreamStore.cs
- TextContainerChangeEventArgs.cs
- AsyncInvokeContext.cs
- CookieHandler.cs
- CancellationHandler.cs
- graph.cs
- SqlConnectionFactory.cs
- RequestCachingSection.cs
- DataBindEngine.cs
- DesignerSerializationOptionsAttribute.cs
- EventPrivateKey.cs
- LocalizabilityAttribute.cs
- SR.cs
- DataTemplate.cs
- IndicShape.cs
- DurableEnlistmentState.cs
- NavigationProgressEventArgs.cs
- CommandEventArgs.cs
- XmlFileEditor.cs
- IndexedEnumerable.cs
- ImageClickEventArgs.cs
- FaultFormatter.cs
- GenericEnumerator.cs
- BoundPropertyEntry.cs
- RectangleF.cs
- Operator.cs
- ServerType.cs
- ObjectQueryProvider.cs
- AttributeCollection.cs
- IPEndPoint.cs
- PositiveTimeSpanValidator.cs
- DataKey.cs
- ColumnMapProcessor.cs
- BaseCAMarshaler.cs
- CultureTableRecord.cs
- DbQueryCommandTree.cs
- SqlDataSourceQuery.cs
- DesignBinding.cs
- SetIterators.cs
- ProfileModule.cs
- ping.cs
- XmlName.cs
- BooleanProjectedSlot.cs
- InvalidPrinterException.cs
- SessionIDManager.cs
- MasterPage.cs
- XmlSchemaValidationException.cs
- FacetChecker.cs
- BlockCollection.cs
- BorderGapMaskConverter.cs
- AttributeCollection.cs
- ErrorInfoXmlDocument.cs
- SegmentInfo.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- SystemWebExtensionsSectionGroup.cs
- VersionPair.cs
- FormViewCommandEventArgs.cs
- FixedFindEngine.cs
- ExpandoClass.cs
- InheritanceUI.cs
- DelayedRegex.cs
- MDIClient.cs
- InstanceHandleConflictException.cs
- Panel.cs
- RelationshipDetailsCollection.cs
- DocumentXmlWriter.cs
- ContextStack.cs
- DbConnectionInternal.cs
- CategoryGridEntry.cs
- WebExceptionStatus.cs
- XNodeValidator.cs
- SqlClientWrapperSmiStreamChars.cs
- AuditLevel.cs
- SerialStream.cs
- CodeRemoveEventStatement.cs
- Vector3DIndependentAnimationStorage.cs
- TableRow.cs
- VariableQuery.cs
- EngineSiteSapi.cs
- StreamInfo.cs
- UriTemplateTable.cs
- NamespaceInfo.cs
- FileNameEditor.cs
- AssociatedControlConverter.cs
- OracleParameterBinding.cs
- columnmapkeybuilder.cs
- EmptyTextWriter.cs
- SafeRightsManagementPubHandle.cs
- ViewStateException.cs
- X509CertificateStore.cs
- MetadataItem_Static.cs
- DesignSurfaceCollection.cs
- mansign.cs
- FileLoadException.cs
- RenderData.cs