Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / Objects / ELinq / Visitors / LinqTreeNodeEvaluator.cs / 2 / 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
- SeparatorAutomationPeer.cs
- CompositeDataBoundControl.cs
- QilName.cs
- View.cs
- XPathAxisIterator.cs
- FeatureSupport.cs
- CustomAttribute.cs
- SelectionProcessor.cs
- ContextQuery.cs
- MainMenu.cs
- Timer.cs
- Helper.cs
- CodeTypeReference.cs
- ListBase.cs
- RtfNavigator.cs
- SecUtil.cs
- BoolExpressionVisitors.cs
- MultiBindingExpression.cs
- Command.cs
- EntityCommandCompilationException.cs
- Line.cs
- WpfXamlType.cs
- StopStoryboard.cs
- DesignerAttribute.cs
- xmlformatgeneratorstatics.cs
- OverrideMode.cs
- CheckBox.cs
- PowerStatus.cs
- _SSPISessionCache.cs
- RectAnimationUsingKeyFrames.cs
- IntellisenseTextBox.designer.cs
- XmlRawWriterWrapper.cs
- WindowCollection.cs
- PageCodeDomTreeGenerator.cs
- InstancePersistenceException.cs
- WarningException.cs
- LinearGradientBrush.cs
- CompilerResults.cs
- DomNameTable.cs
- PerformanceCounterLib.cs
- DependencyPropertyKey.cs
- XmlToDatasetMap.cs
- EdmConstants.cs
- DataSvcMapFile.cs
- BuildDependencySet.cs
- LoginName.cs
- PropertyFilter.cs
- WebHttpEndpointElement.cs
- TypefaceMap.cs
- BStrWrapper.cs
- SafeNativeMethods.cs
- DrawingVisualDrawingContext.cs
- CodeLabeledStatement.cs
- StyleReferenceConverter.cs
- HtmlTableCellCollection.cs
- ValidationSummary.cs
- UIntPtr.cs
- PolyLineSegmentFigureLogic.cs
- Gdiplus.cs
- SkewTransform.cs
- EntitySqlException.cs
- MenuRenderer.cs
- AnnotationAuthorChangedEventArgs.cs
- FSWPathEditor.cs
- LambdaCompiler.cs
- PageCatalogPart.cs
- MdbDataFileEditor.cs
- DirectionalLight.cs
- FileLoadException.cs
- WindowsSlider.cs
- ConnectionsZone.cs
- FacetChecker.cs
- DataList.cs
- FtpWebRequest.cs
- RecognitionEventArgs.cs
- DBBindings.cs
- XmlTypeMapping.cs
- Rect3DConverter.cs
- TreeIterator.cs
- InitializationEventAttribute.cs
- LogManagementAsyncResult.cs
- RoleGroupCollectionEditor.cs
- CodeMemberProperty.cs
- HitTestFilterBehavior.cs
- _RequestLifetimeSetter.cs
- WebPartZoneCollection.cs
- HtmlTableRowCollection.cs
- Rectangle.cs
- UInt32Converter.cs
- WeakReferenceList.cs
- ExpressionVisitor.cs
- MailMessage.cs
- SelectionChangedEventArgs.cs
- path.cs
- ErrorFormatterPage.cs
- ListControl.cs
- CounterCreationDataCollection.cs
- TextMetrics.cs
- coordinator.cs
- CriticalExceptions.cs