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
- XsdDuration.cs
- InvokeSchedule.cs
- SurrogateChar.cs
- MsmqOutputChannel.cs
- WebPartTransformer.cs
- NotifyParentPropertyAttribute.cs
- SoapAttributes.cs
- AccessText.cs
- Thickness.cs
- ComMethodElementCollection.cs
- AnimationClock.cs
- VirtualPathUtility.cs
- GridViewRow.cs
- DataKeyArray.cs
- Stack.cs
- SelectionPattern.cs
- SimpleModelProvider.cs
- ViewgenGatekeeper.cs
- UpdateCompiler.cs
- NextPreviousPagerField.cs
- OrCondition.cs
- recordstatescratchpad.cs
- TraceListeners.cs
- ReflectionHelper.cs
- UInt64Storage.cs
- CodeTypeOfExpression.cs
- QuaternionValueSerializer.cs
- VideoDrawing.cs
- WebPartConnectionsCancelVerb.cs
- EntityDataSourceState.cs
- CodeThrowExceptionStatement.cs
- TableLayoutPanelBehavior.cs
- TypeConverterHelper.cs
- BuildManager.cs
- CompressStream.cs
- TableRowGroup.cs
- PersistChildrenAttribute.cs
- SiteMembershipCondition.cs
- InvalidCastException.cs
- _SSPIWrapper.cs
- PersonalizableTypeEntry.cs
- CompilerScope.cs
- CompilerInfo.cs
- XPathParser.cs
- Mutex.cs
- FieldAccessException.cs
- MethodAccessException.cs
- SchemaNames.cs
- Separator.cs
- XmlParser.cs
- ToolStrip.cs
- SecurityUtils.cs
- Configuration.cs
- DataIdProcessor.cs
- DebugHandleTracker.cs
- HtmlTableCellCollection.cs
- CatalogZoneBase.cs
- ThumbAutomationPeer.cs
- UnsafeNativeMethodsCLR.cs
- MatrixUtil.cs
- SocketPermission.cs
- StylusDevice.cs
- IntellisenseTextBox.designer.cs
- LocalIdKeyIdentifierClause.cs
- SafeLocalMemHandle.cs
- CallContext.cs
- ProfileSettingsCollection.cs
- Label.cs
- Overlapped.cs
- DirectoryInfo.cs
- DesignerListAdapter.cs
- FactoryId.cs
- ClientConfigurationSystem.cs
- ActiveXContainer.cs
- RC2CryptoServiceProvider.cs
- AmbientLight.cs
- ObjectDataSourceFilteringEventArgs.cs
- OleDbErrorCollection.cs
- PropertyInformationCollection.cs
- WSSecurityXXX2005.cs
- XPathEmptyIterator.cs
- InvokeHandlers.cs
- IMembershipProvider.cs
- SqlDataSourceFilteringEventArgs.cs
- Pair.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- RuntimeDelegateArgument.cs
- FontStyles.cs
- DriveInfo.cs
- Registry.cs
- FrameworkObject.cs
- _SslState.cs
- XmlReflectionMember.cs
- AuthenticationServiceManager.cs
- ExcCanonicalXml.cs
- AdRotator.cs
- ListenerTraceUtility.cs
- SpotLight.cs
- ViewPort3D.cs
- XmlnsDictionary.cs