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
- DataSourceSerializationException.cs
- SkewTransform.cs
- Peer.cs
- SurrogateChar.cs
- AvTraceFormat.cs
- XmlSerializableReader.cs
- GridViewDeletedEventArgs.cs
- EmptyImpersonationContext.cs
- DateTimeConverter.cs
- SubpageParagraph.cs
- LabelAutomationPeer.cs
- MouseActionValueSerializer.cs
- Vars.cs
- VerificationException.cs
- XPathNodePointer.cs
- HtmlGenericControl.cs
- StackOverflowException.cs
- DebugView.cs
- CompiledScopeCriteria.cs
- Mouse.cs
- SafeLibraryHandle.cs
- ArgumentsParser.cs
- ElementProxy.cs
- VirtualPath.cs
- ProtocolViolationException.cs
- UnsafePeerToPeerMethods.cs
- LabelExpression.cs
- TabPageDesigner.cs
- LeftCellWrapper.cs
- ActivityBindForm.cs
- InternalUserCancelledException.cs
- FixedSOMPage.cs
- HttpRawResponse.cs
- ProfessionalColorTable.cs
- RIPEMD160.cs
- DeploymentSection.cs
- MDIControlStrip.cs
- Ipv6Element.cs
- UDPClient.cs
- TableRowCollection.cs
- CustomAttributeSerializer.cs
- CharAnimationBase.cs
- DocumentXmlWriter.cs
- SettingsAttributes.cs
- EmptyStringExpandableObjectConverter.cs
- VectorAnimation.cs
- SubMenuStyleCollection.cs
- sqlser.cs
- BitmapDecoder.cs
- RectangleHotSpot.cs
- WebServiceResponseDesigner.cs
- HashStream.cs
- QualifiedId.cs
- SystemWebExtensionsSectionGroup.cs
- WorkItem.cs
- TypeConverterHelper.cs
- HttpsChannelListener.cs
- FormsAuthenticationEventArgs.cs
- Perspective.cs
- BinaryKeyIdentifierClause.cs
- ListControlDesigner.cs
- OrderedParallelQuery.cs
- CodeVariableReferenceExpression.cs
- Positioning.cs
- Viewport3DVisual.cs
- Rect3DValueSerializer.cs
- ServiceModelActivity.cs
- MemberAccessException.cs
- ProcessModelSection.cs
- ScriptResourceAttribute.cs
- Misc.cs
- RectKeyFrameCollection.cs
- Size.cs
- Repeater.cs
- ScriptControl.cs
- TabControl.cs
- EventProviderClassic.cs
- DockPatternIdentifiers.cs
- WindowsFormsHelpers.cs
- ContainerParaClient.cs
- ButtonField.cs
- TripleDES.cs
- CustomTypeDescriptor.cs
- DriveNotFoundException.cs
- LoginUtil.cs
- RegexBoyerMoore.cs
- BrowserCapabilitiesCompiler.cs
- NamedPermissionSet.cs
- SchemaImporter.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- XmlSchemaSimpleTypeRestriction.cs
- TextContainerChangedEventArgs.cs
- HashSetDebugView.cs
- CompatibleIComparer.cs
- _NegoStream.cs
- ProtocolsSection.cs
- Item.cs
- StringPropertyBuilder.cs
- SequentialActivityDesigner.cs
- MinMaxParagraphWidth.cs