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
- DateTime.cs
- HighlightComponent.cs
- RadioButtonList.cs
- FontNamesConverter.cs
- StringFormat.cs
- XmlSerializerObjectSerializer.cs
- XNodeNavigator.cs
- SerialErrors.cs
- AsynchronousChannel.cs
- HuffModule.cs
- OutputScopeManager.cs
- TextEndOfLine.cs
- ListSourceHelper.cs
- SerializationInfo.cs
- UmAlQuraCalendar.cs
- MDIClient.cs
- GlyphsSerializer.cs
- SourceSwitch.cs
- TextBreakpoint.cs
- CoreSwitches.cs
- XmlExtensionFunction.cs
- AssemblyName.cs
- SessionEndingCancelEventArgs.cs
- PageCache.cs
- EmptyEnumerator.cs
- TransformValueSerializer.cs
- DatatypeImplementation.cs
- SpellerError.cs
- DisposableCollectionWrapper.cs
- OpenTypeLayoutCache.cs
- StylusPointCollection.cs
- HMACMD5.cs
- SqlXmlStorage.cs
- WebServiceData.cs
- SourceLocation.cs
- CommandBindingCollection.cs
- CursorInteropHelper.cs
- DiffuseMaterial.cs
- HuffCodec.cs
- RowVisual.cs
- DefaultTextStore.cs
- TextEditorSpelling.cs
- LogicalMethodInfo.cs
- PieceNameHelper.cs
- Bidi.cs
- Activator.cs
- PropertyMappingExceptionEventArgs.cs
- LinqDataView.cs
- PreProcessInputEventArgs.cs
- TimerEventSubscription.cs
- SizeConverter.cs
- SystemUdpStatistics.cs
- WaitHandleCannotBeOpenedException.cs
- HttpWebRequestElement.cs
- TextChangedEventArgs.cs
- Menu.cs
- KnownBoxes.cs
- PerformanceCounterPermissionEntryCollection.cs
- QueryAsyncResult.cs
- Control.cs
- TypeNameHelper.cs
- EncodingNLS.cs
- ActivityXRefPropertyEditor.cs
- XmlQueryCardinality.cs
- BuildManager.cs
- TextTreeTextElementNode.cs
- CommonObjectSecurity.cs
- IntersectQueryOperator.cs
- MetadataSource.cs
- SeekStoryboard.cs
- BaseCollection.cs
- CapabilitiesState.cs
- SqlDesignerDataSourceView.cs
- ListViewItem.cs
- CodeDOMProvider.cs
- WindowsProgressbar.cs
- ProfileSettings.cs
- XmlDownloadManager.cs
- SourceSwitch.cs
- ToolStripButton.cs
- ListBase.cs
- InputManager.cs
- AttributeUsageAttribute.cs
- AstNode.cs
- StorageAssociationTypeMapping.cs
- MatrixCamera.cs
- Label.cs
- TCPListener.cs
- DeleteHelper.cs
- BlurEffect.cs
- ContextMenu.cs
- XhtmlBasicLabelAdapter.cs
- CssStyleCollection.cs
- UInt64.cs
- ResXResourceReader.cs
- InputManager.cs
- SQLBinaryStorage.cs
- WindowsRichEditRange.cs
- CompareValidator.cs
- ToolStripManager.cs