Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataEntity / System / Data / Common / EntitySql / DotExpr.cs / 2 / 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
- MasterPage.cs
- MDIWindowDialog.cs
- GenericUriParser.cs
- GenericArgumentsUpdater.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- ByteStreamMessageEncoderFactory.cs
- ThreadExceptionEvent.cs
- SecurityDescriptor.cs
- TdsParser.cs
- COM2EnumConverter.cs
- VectorValueSerializer.cs
- XmlAttributeCache.cs
- MasterPageParser.cs
- PopOutPanel.cs
- InheritanceRules.cs
- FloaterParaClient.cs
- ObjectManager.cs
- ContentWrapperAttribute.cs
- StylusDownEventArgs.cs
- XmlChildNodes.cs
- ByteKeyFrameCollection.cs
- ToolboxDataAttribute.cs
- StyleSheetRefUrlEditor.cs
- ProgramPublisher.cs
- OptimisticConcurrencyException.cs
- HttpWebRequestElement.cs
- MatrixStack.cs
- ListViewContainer.cs
- FlowDocumentPageViewerAutomationPeer.cs
- OleServicesContext.cs
- BitmapCache.cs
- SchemaTableOptionalColumn.cs
- TypePresenter.xaml.cs
- ShutDownListener.cs
- DataTableNewRowEvent.cs
- AuthenticationModeHelper.cs
- ResourceExpressionBuilder.cs
- CacheVirtualItemsEvent.cs
- AndCondition.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- OpCodes.cs
- SessionEndingCancelEventArgs.cs
- SecurityContext.cs
- SuppressMessageAttribute.cs
- DesignerActionMethodItem.cs
- GeometryModel3D.cs
- SystemParameters.cs
- SevenBitStream.cs
- HiddenField.cs
- GeometryDrawing.cs
- GACIdentityPermission.cs
- BitmapCodecInfo.cs
- AutomationTextAttribute.cs
- HelpInfo.cs
- EventLogger.cs
- ConditionBrowserDialog.cs
- HttpServerUtilityWrapper.cs
- TiffBitmapDecoder.cs
- DBConnection.cs
- IgnoreDeviceFilterElementCollection.cs
- ComponentManagerBroker.cs
- FloatAverageAggregationOperator.cs
- Dispatcher.cs
- BindingExpression.cs
- CodeNamespaceImportCollection.cs
- VariantWrapper.cs
- BitmapData.cs
- KeyValueSerializer.cs
- LicFileLicenseProvider.cs
- SqlFunctionAttribute.cs
- Bitmap.cs
- SigningCredentials.cs
- PairComparer.cs
- CommandID.cs
- SimpleNameService.cs
- XPathDocumentBuilder.cs
- BCLDebug.cs
- OuterGlowBitmapEffect.cs
- BooleanFacetDescriptionElement.cs
- FlatButtonAppearance.cs
- TextDecorationUnitValidation.cs
- TableColumnCollection.cs
- TemplateField.cs
- DuplicateWaitObjectException.cs
- ImageList.cs
- WebPartConnectionsConfigureVerb.cs
- TrackingServices.cs
- XmlSchemaSubstitutionGroup.cs
- XsdCachingReader.cs
- BitmapCodecInfo.cs
- ObjectIDGenerator.cs
- Compiler.cs
- SimpleFieldTemplateUserControl.cs
- Dictionary.cs
- ServiceModelActivity.cs
- ParentUndoUnit.cs
- MethodToken.cs
- TypeSystem.cs
- HttpCapabilitiesBase.cs
- DateTimeUtil.cs