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
- XmlHierarchicalEnumerable.cs
- WebResponse.cs
- ProfileEventArgs.cs
- QilValidationVisitor.cs
- Calendar.cs
- ButtonColumn.cs
- SessionPageStateSection.cs
- SecurityKeyIdentifier.cs
- SystemResources.cs
- SynchronizedDispatch.cs
- PowerModeChangedEventArgs.cs
- TraceListeners.cs
- MultiByteCodec.cs
- WebPartChrome.cs
- ForwardPositionQuery.cs
- StorageFunctionMapping.cs
- ExecutionContext.cs
- X509AudioLogo.cs
- Random.cs
- LocalBuilder.cs
- SamlAttributeStatement.cs
- TextRunProperties.cs
- AuthenticationException.cs
- EditingCoordinator.cs
- WindowsTab.cs
- BlurBitmapEffect.cs
- ToolStripMenuItem.cs
- VisualTreeUtils.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- FrameworkPropertyMetadata.cs
- ButtonBase.cs
- RowToParametersTransformer.cs
- cryptoapiTransform.cs
- TreePrinter.cs
- TraversalRequest.cs
- ParallelTimeline.cs
- AndCondition.cs
- BamlResourceDeserializer.cs
- SelectionHighlightInfo.cs
- IndexedString.cs
- ManagedWndProcTracker.cs
- Hash.cs
- WebEventTraceProvider.cs
- DataSourceCache.cs
- ClientProxyGenerator.cs
- LineServicesRun.cs
- CompilationSection.cs
- Int64.cs
- SoundPlayerAction.cs
- SQLInt32.cs
- XmlSchemaIdentityConstraint.cs
- ZoomComboBox.cs
- ImageSourceValueSerializer.cs
- EventSetter.cs
- StreamAsIStream.cs
- SimpleHandlerBuildProvider.cs
- XmlValidatingReader.cs
- DataGridAutoFormat.cs
- Int16Storage.cs
- DispatcherObject.cs
- CurrentChangingEventManager.cs
- WmlPanelAdapter.cs
- MailWriter.cs
- ContentType.cs
- ResourcePool.cs
- DataObjectSettingDataEventArgs.cs
- TypeExtensionConverter.cs
- DispatcherBuilder.cs
- OracleDateTime.cs
- PixelShader.cs
- MaskedTextProvider.cs
- EncoderReplacementFallback.cs
- HttpCacheVaryByContentEncodings.cs
- _BufferOffsetSize.cs
- input.cs
- PKCS1MaskGenerationMethod.cs
- VirtualDirectoryMappingCollection.cs
- LinqDataSourceDeleteEventArgs.cs
- DbProviderFactory.cs
- FixedSchema.cs
- TypedCompletedAsyncResult.cs
- BinaryParser.cs
- DataControlPagerLinkButton.cs
- KeyValueConfigurationCollection.cs
- PolygonHotSpot.cs
- CatalogPartDesigner.cs
- XMLUtil.cs
- PagerSettings.cs
- SemaphoreSecurity.cs
- NetMsmqSecurityElement.cs
- UInt64Converter.cs
- UpdateTracker.cs
- FloatAverageAggregationOperator.cs
- NameSpaceExtractor.cs
- PropertyStore.cs
- sqlser.cs
- MemberAssignmentAnalysis.cs
- BufferAllocator.cs
- ToolStripItem.cs
- VirtualDirectoryMappingCollection.cs