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
- DataGridTablesFactory.cs
- MultiTrigger.cs
- ActivityTypeResolver.xaml.cs
- SqlCommandSet.cs
- CodeAccessSecurityEngine.cs
- IMembershipProvider.cs
- ScalarType.cs
- UdpMessageProperty.cs
- ContextMenuService.cs
- RotateTransform3D.cs
- WebBrowserDocumentCompletedEventHandler.cs
- InputManager.cs
- Compress.cs
- EnumConverter.cs
- HwndHost.cs
- DragEventArgs.cs
- TiffBitmapEncoder.cs
- EmptyImpersonationContext.cs
- DesignerCatalogPartChrome.cs
- VirtualPathUtility.cs
- DbMetaDataCollectionNames.cs
- ResXResourceWriter.cs
- DataColumnCollection.cs
- ListViewEditEventArgs.cs
- PropertiesTab.cs
- DataSourceHelper.cs
- CommandDevice.cs
- SystemTcpStatistics.cs
- TextCollapsingProperties.cs
- Token.cs
- SortedSet.cs
- MouseActionConverter.cs
- NodeInfo.cs
- TypedDataSetSchemaImporterExtension.cs
- DataGridViewSelectedCellCollection.cs
- DataShape.cs
- Int16AnimationUsingKeyFrames.cs
- PointLight.cs
- graph.cs
- ColumnResizeAdorner.cs
- DataSourceCacheDurationConverter.cs
- Win32Exception.cs
- ByteAnimationBase.cs
- LocalValueEnumerator.cs
- VScrollBar.cs
- FileDialog.cs
- HtmlAnchor.cs
- Brushes.cs
- ToolboxItemFilterAttribute.cs
- FullTextLine.cs
- ApplicationDirectory.cs
- LocatorManager.cs
- sqlstateclientmanager.cs
- Rotation3DKeyFrameCollection.cs
- webclient.cs
- ContentHostHelper.cs
- FlowLayoutPanel.cs
- ImageInfo.cs
- ExpandCollapseProviderWrapper.cs
- DisplayNameAttribute.cs
- PersistenceTask.cs
- WindowsSecurityToken.cs
- Events.cs
- WebServiceClientProxyGenerator.cs
- SafeHandles.cs
- XmlSchemaAppInfo.cs
- UserControl.cs
- ExpressionBindingCollection.cs
- StaticContext.cs
- Vector3DCollectionConverter.cs
- AuthorizationRuleCollection.cs
- ReceiveCompletedEventArgs.cs
- DesignerPainter.cs
- SessionStateModule.cs
- LinkLabelLinkClickedEvent.cs
- XPathNavigator.cs
- ScrollItemProviderWrapper.cs
- TextRange.cs
- WebPartConnectionsEventArgs.cs
- TempFiles.cs
- SourceChangedEventArgs.cs
- EntityDataSourceStatementEditorForm.cs
- SqlLiftWhereClauses.cs
- SqlUserDefinedTypeAttribute.cs
- CategoryGridEntry.cs
- MergeFailedEvent.cs
- BamlBinaryReader.cs
- TextEditorMouse.cs
- ExceptionValidationRule.cs
- OleStrCAMarshaler.cs
- RowParagraph.cs
- DbTransaction.cs
- StylusSystemGestureEventArgs.cs
- TextEditor.cs
- DispatcherObject.cs
- DisplayNameAttribute.cs
- Line.cs
- FramingChannels.cs
- EventArgs.cs
- LayoutEditorPart.cs