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
- CommandBinding.cs
- TypeConverterAttribute.cs
- DrawingContextWalker.cs
- StylusEventArgs.cs
- SchemaMapping.cs
- PropertyDescriptorCollection.cs
- FastEncoderWindow.cs
- RowType.cs
- AuthorizationSection.cs
- DragEventArgs.cs
- QilReplaceVisitor.cs
- DataServiceQuery.cs
- ConfigurationValidatorAttribute.cs
- StrokeCollection.cs
- MouseEvent.cs
- httpapplicationstate.cs
- StringValueSerializer.cs
- XmlSchemaValidationException.cs
- RadioButton.cs
- InvokeProviderWrapper.cs
- MatrixTransform3D.cs
- RTLAwareMessageBox.cs
- WebPart.cs
- CancellationToken.cs
- DataGridViewCellParsingEventArgs.cs
- SoapServerProtocol.cs
- TextSelection.cs
- HtmlControlAdapter.cs
- ClrProviderManifest.cs
- CodeMemberEvent.cs
- NavigatingCancelEventArgs.cs
- wgx_render.cs
- CommandConverter.cs
- CalendarAutomationPeer.cs
- RadialGradientBrush.cs
- ServerValidateEventArgs.cs
- DataContract.cs
- TypeDescriptionProvider.cs
- listitem.cs
- FilterableAttribute.cs
- XPathDocumentNavigator.cs
- ReadOnlyNameValueCollection.cs
- NCryptSafeHandles.cs
- DefaultAsyncDataDispatcher.cs
- BehaviorEditorPart.cs
- Deflater.cs
- UnsafeNativeMethods.cs
- CardSpaceException.cs
- BrowserInteropHelper.cs
- SystemIPInterfaceProperties.cs
- ResourcePermissionBaseEntry.cs
- MembershipValidatePasswordEventArgs.cs
- OdbcErrorCollection.cs
- TTSEngineTypes.cs
- PolicyFactory.cs
- ViewgenGatekeeper.cs
- EncoderBestFitFallback.cs
- CopyOnWriteList.cs
- CodeEventReferenceExpression.cs
- Clipboard.cs
- TransactionWaitAsyncResult.cs
- BoundPropertyEntry.cs
- DictionaryMarkupSerializer.cs
- DataTemplate.cs
- ViewCellRelation.cs
- CorrelationTokenTypeConvertor.cs
- ThemeableAttribute.cs
- Converter.cs
- UniqueSet.cs
- SHA256Managed.cs
- XmlIncludeAttribute.cs
- FilterableAttribute.cs
- EntityFunctions.cs
- UpdateTracker.cs
- DataBoundControlAdapter.cs
- BaseDataList.cs
- DrawingGroupDrawingContext.cs
- BooleanFunctions.cs
- PointCollectionConverter.cs
- BitmapPalettes.cs
- ReceiveReply.cs
- CustomPopupPlacement.cs
- Model3DCollection.cs
- TypeConverterHelper.cs
- PerformanceCounterPermissionAttribute.cs
- TogglePattern.cs
- MonitorWrapper.cs
- FreeFormDesigner.cs
- Matrix3D.cs
- SingleStorage.cs
- WindowsEditBox.cs
- NullableFloatMinMaxAggregationOperator.cs
- WebBrowserContainer.cs
- TextLineResult.cs
- AttributeQuery.cs
- PointLightBase.cs
- GridViewColumnCollectionChangedEventArgs.cs
- SqlBooleanMismatchVisitor.cs
- InlinedLocationReference.cs
- cookie.cs