Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- Page.cs
- BitmapEffectCollection.cs
- DBBindings.cs
- EventHandlerList.cs
- XmlArrayAttribute.cs
- UnsafeNativeMethods.cs
- WmlLabelAdapter.cs
- XmlTextAttribute.cs
- CodeSnippetCompileUnit.cs
- ObjectCloneHelper.cs
- UnsafeNativeMethods.cs
- ObjectDataSourceStatusEventArgs.cs
- RequestNavigateEventArgs.cs
- QuaternionRotation3D.cs
- ToolStripStatusLabel.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- InstanceData.cs
- UnsafeNativeMethodsPenimc.cs
- DBParameter.cs
- ZipIOLocalFileHeader.cs
- FormViewDeleteEventArgs.cs
- DataGridViewTextBoxEditingControl.cs
- SQLBoolean.cs
- UserControlAutomationPeer.cs
- Int64AnimationUsingKeyFrames.cs
- FrameworkContentElementAutomationPeer.cs
- ACE.cs
- SqlXmlStorage.cs
- _SingleItemRequestCache.cs
- AccessedThroughPropertyAttribute.cs
- ListViewDeleteEventArgs.cs
- ListViewItemSelectionChangedEvent.cs
- RequestContext.cs
- StorageEndPropertyMapping.cs
- DispatcherExceptionEventArgs.cs
- XmlTextReaderImpl.cs
- PartBasedPackageProperties.cs
- DbProviderSpecificTypePropertyAttribute.cs
- Bookmark.cs
- TextBox.cs
- PageThemeCodeDomTreeGenerator.cs
- ReaderWriterLockWrapper.cs
- EntityClassGenerator.cs
- OverlappedAsyncResult.cs
- CompiledQuery.cs
- BamlMapTable.cs
- PropertyManager.cs
- TiffBitmapEncoder.cs
- GroupBox.cs
- BlurBitmapEffect.cs
- ListViewSelectEventArgs.cs
- RemoteWebConfigurationHostServer.cs
- SqlSelectStatement.cs
- _WinHttpWebProxyDataBuilder.cs
- CookieHandler.cs
- ColorKeyFrameCollection.cs
- BigInt.cs
- Stylus.cs
- CodeExporter.cs
- newitemfactory.cs
- TextPenaltyModule.cs
- GenericEnumConverter.cs
- EraserBehavior.cs
- RightsManagementEncryptionTransform.cs
- ImageConverter.cs
- XmlSchemaSimpleContentRestriction.cs
- XmlSchemaAppInfo.cs
- DataSourceCache.cs
- EntityDataSourceValidationException.cs
- FontNameConverter.cs
- SoapSchemaExporter.cs
- Rule.cs
- RSAPKCS1SignatureFormatter.cs
- _NetworkingPerfCounters.cs
- InputScopeNameConverter.cs
- TextBox.cs
- WmlObjectListAdapter.cs
- NativeMethods.cs
- RelatedCurrencyManager.cs
- DocumentReferenceCollection.cs
- NamedElement.cs
- PageParserFilter.cs
- ImageDrawing.cs
- UnsafePeerToPeerMethods.cs
- IndexingContentUnit.cs
- ListItemCollection.cs
- Win32.cs
- KeyGestureValueSerializer.cs
- Normalization.cs
- BaseParagraph.cs
- BufferedWebEventProvider.cs
- TCEAdapterGenerator.cs
- BuildProviderCollection.cs
- ProfileManager.cs
- BaseCodeDomTreeGenerator.cs
- CompensationHandlingFilter.cs
- EasingKeyFrames.cs
- ManipulationVelocities.cs
- PowerStatus.cs
- SrgsGrammar.cs