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
- XmlSchemaProviderAttribute.cs
- FirstMatchCodeGroup.cs
- FileLoadException.cs
- AttributeUsageAttribute.cs
- HtmlTableRow.cs
- ToolStripItemCollection.cs
- BindingMemberInfo.cs
- PackagePart.cs
- DisplayInformation.cs
- HandlerMappingMemo.cs
- TreeNodeStyle.cs
- ThreadAbortException.cs
- BasePattern.cs
- SqlDependencyListener.cs
- BooleanFunctions.cs
- ParameterBuilder.cs
- WizardPanel.cs
- SrgsText.cs
- HtmlInputImage.cs
- XPathDocumentIterator.cs
- Frame.cs
- SqlEnums.cs
- SchemaCollectionCompiler.cs
- WebPartMovingEventArgs.cs
- TrustManager.cs
- ThousandthOfEmRealPoints.cs
- PropertyValue.cs
- HtmlImage.cs
- BuildResultCache.cs
- MD5HashHelper.cs
- ReadOnlyAttribute.cs
- URI.cs
- SortKey.cs
- StateMachine.cs
- SqlFunctionAttribute.cs
- EntityConnectionStringBuilderItem.cs
- ToolboxItemImageConverter.cs
- AttributeCollection.cs
- ComplexBindingPropertiesAttribute.cs
- TagPrefixAttribute.cs
- WebPartConnectionsDisconnectVerb.cs
- IgnoreSectionHandler.cs
- PerformanceCounterManager.cs
- MappedMetaModel.cs
- ObjectDataSourceEventArgs.cs
- DocumentViewer.cs
- ComEventsSink.cs
- XmlMtomWriter.cs
- AppDomainProtocolHandler.cs
- columnmapkeybuilder.cs
- FormViewModeEventArgs.cs
- documentation.cs
- TextServicesDisplayAttribute.cs
- SelectionHighlightInfo.cs
- ValueQuery.cs
- OutputCacheProfileCollection.cs
- XmlAttribute.cs
- LocalBuilder.cs
- StringConverter.cs
- TextProperties.cs
- AssemblyAttributes.cs
- ManagementPath.cs
- MinMaxParagraphWidth.cs
- Adorner.cs
- Typeface.cs
- EmbeddedObject.cs
- SqlNodeTypeOperators.cs
- DataGridViewButtonColumn.cs
- WebPartDeleteVerb.cs
- WCFBuildProvider.cs
- ExpressionCopier.cs
- BulletChrome.cs
- EventLogger.cs
- reliableinputsessionchannel.cs
- MetadataCache.cs
- NavigationCommands.cs
- PersonalizationStateInfo.cs
- ValidationPropertyAttribute.cs
- X509SecurityTokenAuthenticator.cs
- IpcManager.cs
- ListGeneralPage.cs
- ControlBuilder.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- UnsafeNativeMethods.cs
- IPCCacheManager.cs
- Bold.cs
- RadioButton.cs
- FixedBufferAttribute.cs
- _BasicClient.cs
- RandomNumberGenerator.cs
- EmissiveMaterial.cs
- ParameterReplacerVisitor.cs
- ObjectQueryExecutionPlan.cs
- TextLineResult.cs
- StackBuilderSink.cs
- WorkflowInvoker.cs
- UnmanagedMemoryStream.cs
- IDispatchConstantAttribute.cs
- TextPointerBase.cs
- FileUpload.cs