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
- DataObject.cs
- ObjectDataProvider.cs
- RawStylusInput.cs
- DataGridRowsPresenter.cs
- ObservableCollectionDefaultValueFactory.cs
- Bind.cs
- DrawingVisualDrawingContext.cs
- RedirectionProxy.cs
- MediaContextNotificationWindow.cs
- Int32RectValueSerializer.cs
- Ppl.cs
- MissingSatelliteAssemblyException.cs
- FontNamesConverter.cs
- ConfigurationValue.cs
- Base64Encoder.cs
- HashCodeCombiner.cs
- XamlToRtfWriter.cs
- SqlDataSourceCache.cs
- ProgressBar.cs
- EventWaitHandleSecurity.cs
- TableAutomationPeer.cs
- WebPartMinimizeVerb.cs
- XPathAncestorIterator.cs
- RichTextBox.cs
- SmtpNegotiateAuthenticationModule.cs
- InplaceBitmapMetadataWriter.cs
- SqlStream.cs
- RelatedView.cs
- XsdBuildProvider.cs
- ToolBarDesigner.cs
- CodeVariableReferenceExpression.cs
- MemoryFailPoint.cs
- DocumentViewer.cs
- Transactions.cs
- XmlMemberMapping.cs
- TemplateInstanceAttribute.cs
- CuspData.cs
- XsltInput.cs
- ListView.cs
- SelectionWordBreaker.cs
- Int64Converter.cs
- ArrayConverter.cs
- ExtendedPropertiesHandler.cs
- AuthenticationException.cs
- CodeConditionStatement.cs
- PermissionSetTriple.cs
- MailMessage.cs
- CodeDirectionExpression.cs
- DependencyObjectType.cs
- JsonReaderDelegator.cs
- MetaModel.cs
- InternalsVisibleToAttribute.cs
- BinaryFormatterWriter.cs
- HtmlControlPersistable.cs
- UriPrefixTable.cs
- StylusOverProperty.cs
- FaultHandlingFilter.cs
- CorrelationService.cs
- UInt32.cs
- AsyncOperation.cs
- LoginUtil.cs
- SignatureDescription.cs
- DelegateSerializationHolder.cs
- ChannelServices.cs
- Help.cs
- ChangeProcessor.cs
- HelpOperationInvoker.cs
- ChannelSettingsElement.cs
- Menu.cs
- EventMappingSettings.cs
- XmlCharCheckingWriter.cs
- ImageCodecInfoPrivate.cs
- Size3D.cs
- EndOfStreamException.cs
- MessageQueue.cs
- LookupNode.cs
- XmlObjectSerializerWriteContextComplex.cs
- TaskHelper.cs
- RadioButton.cs
- GenericXmlSecurityTokenAuthenticator.cs
- BuilderInfo.cs
- ThreadAttributes.cs
- FormsAuthentication.cs
- DomNameTable.cs
- FamilyMapCollection.cs
- KeyFrames.cs
- RowParagraph.cs
- TextParagraph.cs
- DbgCompiler.cs
- SecurityHelper.cs
- Header.cs
- FloaterBaseParagraph.cs
- Assert.cs
- EventData.cs
- DataGridLinkButton.cs
- UrlMapping.cs
- DetailsViewUpdatedEventArgs.cs
- PathNode.cs
- DataStreams.cs
- RuntimeEnvironment.cs