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
- SafeNativeMethodsMilCoreApi.cs
- XpsException.cs
- EditorPart.cs
- Missing.cs
- ScopelessEnumAttribute.cs
- OpenFileDialog.cs
- DataGridColumnHeadersPresenter.cs
- OracleParameterCollection.cs
- CompilerCollection.cs
- CompatibleIComparer.cs
- SiteMap.cs
- StorageEndPropertyMapping.cs
- MSHTMLHostUtil.cs
- Misc.cs
- ConfigurationStrings.cs
- ChtmlLinkAdapter.cs
- WinEventHandler.cs
- DSASignatureFormatter.cs
- Bitmap.cs
- DependencyPropertyChangedEventArgs.cs
- XPathPatternBuilder.cs
- CompilationLock.cs
- GAC.cs
- SmtpNtlmAuthenticationModule.cs
- SafeNativeMethods.cs
- SQLDecimal.cs
- DeferredReference.cs
- ADConnectionHelper.cs
- MultiplexingFormatMapping.cs
- Config.cs
- WebPageTraceListener.cs
- RelationshipType.cs
- WpfPayload.cs
- PlainXmlSerializer.cs
- Context.cs
- XmlCodeExporter.cs
- DialogResultConverter.cs
- SynchronizingStream.cs
- XmlTypeAttribute.cs
- LocalizabilityAttribute.cs
- DynamicValueConverter.cs
- Facet.cs
- DispatcherEventArgs.cs
- NullableLongMinMaxAggregationOperator.cs
- MimeTypePropertyAttribute.cs
- GenericPrincipal.cs
- DateTimeOffset.cs
- TextAutomationPeer.cs
- AutoGeneratedField.cs
- ServicesUtilities.cs
- SchemaMapping.cs
- ToolStripRenderer.cs
- SendContent.cs
- SelectionPattern.cs
- ColorTransformHelper.cs
- ParserHooks.cs
- MDIClient.cs
- SuppressMergeCheckAttribute.cs
- SizeAnimationBase.cs
- ToolStripDropDownDesigner.cs
- GridViewDeletedEventArgs.cs
- FilteredAttributeCollection.cs
- ScriptingJsonSerializationSection.cs
- X509ChainElement.cs
- AbstractExpressions.cs
- ValueOfAction.cs
- SecurityHeaderLayout.cs
- LocatorGroup.cs
- HtmlGenericControl.cs
- ContainerUtilities.cs
- NumericExpr.cs
- ModulesEntry.cs
- DataGridItem.cs
- UIElementParagraph.cs
- TextTreeText.cs
- CompModHelpers.cs
- ResolveResponse.cs
- QilTargetType.cs
- AuditLogLocation.cs
- EntityStoreSchemaGenerator.cs
- CatchDesigner.xaml.cs
- DataGridViewColumn.cs
- OracleDataReader.cs
- KeyedHashAlgorithm.cs
- OdbcFactory.cs
- DocumentPageTextView.cs
- JournalEntryStack.cs
- Timer.cs
- BulletChrome.cs
- UInt64.cs
- SmtpAuthenticationManager.cs
- NamespaceInfo.cs
- EndpointAddress10.cs
- ContractBase.cs
- UnSafeCharBuffer.cs
- QuadTree.cs
- DataGridViewRow.cs
- NonClientArea.cs
- TraceSection.cs
- PerformanceCounterPermissionEntry.cs