Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataEntity / System / Data / Objects / ELinq / Visitors / LinqTreeNodeEvaluator.cs / 1 / LinqTreeNodeEvaluator.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....], [....] //--------------------------------------------------------------------- using System.Linq.Expressions; using System.Collections.Generic; namespace System.Data.Objects.ELinq { ////// Goes from the bottom to top and nominates nodes where all the nodes /// below the node return true from the shouldBeNominatedDelegate /// internal sealed class LinqTreeNodeEvaluator : ExpressionVisitor { HashSet_nodesToEvaluate; private LinqTreeNodeEvaluator(HashSet nodesToEvaluate) { _nodesToEvaluate = nodesToEvaluate; } internal static Expression EvaluateClosuresAndClientEvalNodes(Expression expression) { return Evaluate(expression, LinqMaximalSubtreeNominator.Nominate( expression, new HashSet (), e => ExpressionEvaluator.IsExpressionNodeAClosure(e) || ExpressionEvaluator.IsExpressionNodeClientEvaluatable(e) ) ); } internal static Expression Evaluate(Expression expression, HashSet nodesToEvaluate) { if (nodesToEvaluate.Count == 0) { // I can save you some time on this one... return expression; } LinqTreeNodeEvaluator nominator = new LinqTreeNodeEvaluator(nodesToEvaluate); return nominator.Visit(expression); } internal override Expression Visit(Expression exp) { if (exp != null && exp.NodeType != ExpressionType.Constant && _nodesToEvaluate.Contains(exp)) { return Expression.Constant(ExpressionEvaluator.EvaluateExpression(exp), exp.Type); } return base.Visit(exp); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....], [....] //--------------------------------------------------------------------- using System.Linq.Expressions; using System.Collections.Generic; namespace System.Data.Objects.ELinq { ////// Goes from the bottom to top and nominates nodes where all the nodes /// below the node return true from the shouldBeNominatedDelegate /// internal sealed class LinqTreeNodeEvaluator : ExpressionVisitor { HashSet_nodesToEvaluate; private LinqTreeNodeEvaluator(HashSet nodesToEvaluate) { _nodesToEvaluate = nodesToEvaluate; } internal static Expression EvaluateClosuresAndClientEvalNodes(Expression expression) { return Evaluate(expression, LinqMaximalSubtreeNominator.Nominate( expression, new HashSet (), e => ExpressionEvaluator.IsExpressionNodeAClosure(e) || ExpressionEvaluator.IsExpressionNodeClientEvaluatable(e) ) ); } internal static Expression Evaluate(Expression expression, HashSet nodesToEvaluate) { if (nodesToEvaluate.Count == 0) { // I can save you some time on this one... return expression; } LinqTreeNodeEvaluator nominator = new LinqTreeNodeEvaluator(nodesToEvaluate); return nominator.Visit(expression); } internal override Expression Visit(Expression exp) { if (exp != null && exp.NodeType != ExpressionType.Constant && _nodesToEvaluate.Contains(exp)) { return Expression.Constant(ExpressionEvaluator.EvaluateExpression(exp), exp.Type); } return base.Visit(exp); } } } // 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
- VirtualPathUtility.cs
- Menu.cs
- DataRecordInfo.cs
- CodeDirectoryCompiler.cs
- NetNamedPipeBinding.cs
- ArgIterator.cs
- MetaDataInfo.cs
- NonVisualControlAttribute.cs
- followingquery.cs
- Base64Stream.cs
- IndexedWhereQueryOperator.cs
- ToolStripSplitStackLayout.cs
- RsaKeyIdentifierClause.cs
- UIElementParaClient.cs
- CanonicalXml.cs
- AbsoluteQuery.cs
- Regex.cs
- DbParameterCollectionHelper.cs
- IODescriptionAttribute.cs
- GlobalEventManager.cs
- ContactManager.cs
- ItemsChangedEventArgs.cs
- UtilityExtension.cs
- GeometryDrawing.cs
- CoreChannel.cs
- RegistryKey.cs
- ImageCodecInfoPrivate.cs
- XmlWrappingReader.cs
- XmlSchemaExternal.cs
- X509ThumbprintKeyIdentifierClause.cs
- WebServiceHandler.cs
- EdmItemCollection.cs
- MouseActionValueSerializer.cs
- LoadWorkflowAsyncResult.cs
- SchemaEntity.cs
- CreationContext.cs
- FeedUtils.cs
- SqlMethodCallConverter.cs
- ViewStateException.cs
- XmlSchemaSimpleContent.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- DefaultSection.cs
- ItemsChangedEventArgs.cs
- ResourceSet.cs
- Figure.cs
- CodeChecksumPragma.cs
- SQLInt32Storage.cs
- TaskHelper.cs
- GenericUI.cs
- ProfilePropertySettings.cs
- SpoolingTaskBase.cs
- newitemfactory.cs
- XmlSchemaSimpleTypeRestriction.cs
- EmptyQuery.cs
- ActiveXHelper.cs
- PlacementWorkspace.cs
- IdnElement.cs
- Binding.cs
- CachedFontFamily.cs
- DbXmlEnabledProviderManifest.cs
- HtmlControl.cs
- Html32TextWriter.cs
- XmlChildNodes.cs
- XmlTextReaderImpl.cs
- Token.cs
- WindowsFormsSynchronizationContext.cs
- CodeSnippetCompileUnit.cs
- NetworkStream.cs
- Registry.cs
- ObjectPersistData.cs
- ConfigurationStrings.cs
- StringPropertyBuilder.cs
- SByteConverter.cs
- SiteMapNodeCollection.cs
- PreviewPageInfo.cs
- GetMemberBinder.cs
- ClientRolePrincipal.cs
- Configuration.cs
- TouchEventArgs.cs
- MenuItem.cs
- ControlTemplate.cs
- DataGridViewDataConnection.cs
- CodeGenerator.cs
- DataViewManager.cs
- HttpApplication.cs
- AnimationClockResource.cs
- TabItemWrapperAutomationPeer.cs
- DbConnectionPoolOptions.cs
- PtsContext.cs
- GifBitmapEncoder.cs
- DataGridCell.cs
- Icon.cs
- OrderedDictionaryStateHelper.cs
- ITreeGenerator.cs
- TranslateTransform3D.cs
- AtomEntry.cs
- StrokeCollectionConverter.cs
- UIntPtr.cs
- FloaterBaseParaClient.cs
- ElementHost.cs