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
- DataService.cs
- EntityDataSourceContextDisposingEventArgs.cs
- CompareValidator.cs
- UrlMappingCollection.cs
- PropertyMapper.cs
- LogManagementAsyncResult.cs
- ParamArrayAttribute.cs
- KeyTime.cs
- KeyValueInternalCollection.cs
- WpfWebRequestHelper.cs
- WindowsListViewGroupHelper.cs
- CompoundFileReference.cs
- Decoder.cs
- DeferrableContent.cs
- WorkItem.cs
- DesignTimeVisibleAttribute.cs
- HScrollBar.cs
- XamlFxTrace.cs
- IDataContractSurrogate.cs
- ParameterRetriever.cs
- XmlSchemaNotation.cs
- WebHttpSecurityElement.cs
- SqlBulkCopyColumnMappingCollection.cs
- TextEditorThreadLocalStore.cs
- ProcessModule.cs
- UnicodeEncoding.cs
- HttpRequestCacheValidator.cs
- RequestTimeoutManager.cs
- ObjectResult.cs
- TextReader.cs
- Pipe.cs
- WindowsContainer.cs
- HitTestFilterBehavior.cs
- PersonalizationAdministration.cs
- ListInitExpression.cs
- ListBoxItemAutomationPeer.cs
- ConfigurationHandlersInstallComponent.cs
- ActivitiesCollection.cs
- XPathDocument.cs
- mediapermission.cs
- CodeDirectiveCollection.cs
- WindowsSlider.cs
- Parallel.cs
- DefaultValidator.cs
- HScrollBar.cs
- WorkflowMarkupSerializationManager.cs
- MarshalByRefObject.cs
- PropertyPath.cs
- HttpCapabilitiesEvaluator.cs
- ToolStripItemCollection.cs
- PlatformNotSupportedException.cs
- ToolStripItemClickedEventArgs.cs
- DataView.cs
- EntityDataSourceWrapperCollection.cs
- OletxTransactionHeader.cs
- DataServiceRequestOfT.cs
- PropertyPathConverter.cs
- CompositeCollection.cs
- BaseResourcesBuildProvider.cs
- ListDictionaryInternal.cs
- XmlToDatasetMap.cs
- CodeMemberEvent.cs
- TabControlEvent.cs
- PageEventArgs.cs
- UriWriter.cs
- TransformGroup.cs
- HttpConfigurationSystem.cs
- ButtonFieldBase.cs
- _AuthenticationState.cs
- FontInfo.cs
- InfoCardRSAPKCS1KeyExchangeFormatter.cs
- CryptoApi.cs
- DbParameterCollectionHelper.cs
- Missing.cs
- MetaModel.cs
- UnicastIPAddressInformationCollection.cs
- TimeSpanConverter.cs
- AuditLogLocation.cs
- BinaryObjectWriter.cs
- TaskCanceledException.cs
- FrameworkElement.cs
- PropertyPath.cs
- SessionStateSection.cs
- SmtpNtlmAuthenticationModule.cs
- _FtpControlStream.cs
- XmlSchemaElement.cs
- ProcessModuleCollection.cs
- BinaryMethodMessage.cs
- OutputWindow.cs
- CrossAppDomainChannel.cs
- ProfileProvider.cs
- BitmapInitialize.cs
- ControlCommandSet.cs
- DateTime.cs
- MemberRelationshipService.cs
- ValidationHelper.cs
- TreeSet.cs
- MergeFailedEvent.cs
- XmlSignificantWhitespace.cs
- TraceListener.cs