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
- TypedCompletedAsyncResult.cs
- SpinLock.cs
- ExtendedProtectionPolicyElement.cs
- DbConnectionOptions.cs
- GreenMethods.cs
- ThreadExceptionDialog.cs
- DependentList.cs
- DataControlButton.cs
- IdentityNotMappedException.cs
- _AutoWebProxyScriptEngine.cs
- JsonClassDataContract.cs
- LayoutExceptionEventArgs.cs
- BindingCollection.cs
- ConstrainedGroup.cs
- PenThreadWorker.cs
- FactoryId.cs
- TableNameAttribute.cs
- FileReader.cs
- RadioButton.cs
- InfoCardRSAPKCS1KeyExchangeFormatter.cs
- TextRangeEditLists.cs
- _NegoStream.cs
- MexHttpBindingCollectionElement.cs
- BuildManager.cs
- COM2IDispatchConverter.cs
- SeekStoryboard.cs
- CollectionBuilder.cs
- CacheMode.cs
- WindowsPen.cs
- CaseInsensitiveHashCodeProvider.cs
- StylusShape.cs
- autovalidator.cs
- BaseParagraph.cs
- BoundsDrawingContextWalker.cs
- PageThemeParser.cs
- CodeGenerator.cs
- OutputCacheProfileCollection.cs
- DataGridViewDataConnection.cs
- WebPartVerb.cs
- WebAdminConfigurationHelper.cs
- ConfigurationManagerHelperFactory.cs
- TemplateColumn.cs
- ClientSettingsSection.cs
- TextSegment.cs
- EnlistmentTraceIdentifier.cs
- ConfigurationStrings.cs
- ToggleProviderWrapper.cs
- HierarchicalDataBoundControlAdapter.cs
- CustomAssemblyResolver.cs
- DetailsViewRowCollection.cs
- EmptyElement.cs
- EntitySetBaseCollection.cs
- EntityStoreSchemaGenerator.cs
- TableItemPattern.cs
- COM2ExtendedUITypeEditor.cs
- CryptoApi.cs
- StateDesigner.TransitionInfo.cs
- XmlAttributeProperties.cs
- SafeMILHandle.cs
- DateTimeConverter.cs
- XmlWhitespace.cs
- ParserStreamGeometryContext.cs
- MemberBinding.cs
- ColumnWidthChangedEvent.cs
- CodeNamespaceImport.cs
- AstTree.cs
- UtilityExtension.cs
- COAUTHINFO.cs
- PeerEndPoint.cs
- DBConnectionString.cs
- CaseCqlBlock.cs
- TraceContextEventArgs.cs
- Point3D.cs
- CaseStatement.cs
- ProtocolsSection.cs
- CardSpaceShim.cs
- TableStyle.cs
- Bidi.cs
- TableLayoutSettings.cs
- CodeDelegateCreateExpression.cs
- ImageListStreamer.cs
- BindingContext.cs
- DataGridViewRowEventArgs.cs
- RoleGroup.cs
- Mutex.cs
- InheritanceContextHelper.cs
- CompletionProxy.cs
- TimeSpanStorage.cs
- ListViewSortEventArgs.cs
- CommandConverter.cs
- OutputWindow.cs
- BitArray.cs
- Evidence.cs
- OperandQuery.cs
- ObjectMemberMapping.cs
- PixelFormat.cs
- Baml6Assembly.cs
- KeyboardInputProviderAcquireFocusEventArgs.cs
- DataMemberConverter.cs
- RectangleF.cs