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
- RelationshipWrapper.cs
- ConfigurationSectionHelper.cs
- Decorator.cs
- MenuItemCollection.cs
- XmlTypeMapping.cs
- QueryOpcode.cs
- MetabaseSettingsIis7.cs
- SettingsProperty.cs
- LinkDesigner.cs
- ApplicationSettingsBase.cs
- ConditionalAttribute.cs
- Vector3DAnimationBase.cs
- DiscoveryUtility.cs
- XmlAttributeAttribute.cs
- XmlWriter.cs
- OpenCollectionAsyncResult.cs
- XmlSignatureProperties.cs
- DataGridViewCheckBoxCell.cs
- WeakEventTable.cs
- MailHeaderInfo.cs
- Utils.cs
- CodeGen.cs
- TabRenderer.cs
- SyntaxCheck.cs
- And.cs
- GetLedgerEntryForRecipientRequest.cs
- SchemaObjectWriter.cs
- SafeMarshalContext.cs
- x509utils.cs
- ProcessHost.cs
- EventMemberCodeDomSerializer.cs
- TextEffect.cs
- EventProviderClassic.cs
- Geometry.cs
- ToolStripDropDown.cs
- SQLConvert.cs
- InputProcessorProfiles.cs
- UInt16Converter.cs
- Matrix3DConverter.cs
- StrongNamePublicKeyBlob.cs
- EventLogPermissionEntry.cs
- UriScheme.cs
- XamlReaderHelper.cs
- DataGridPagerStyle.cs
- ObjectPropertyMapping.cs
- ProxyWebPartManager.cs
- EventLogPermission.cs
- ObjectViewFactory.cs
- BehaviorEditorPart.cs
- ConfigXmlCDataSection.cs
- Debug.cs
- DataObjectAttribute.cs
- StyleXamlParser.cs
- SemanticTag.cs
- ClipboardData.cs
- HotSpotCollectionEditor.cs
- ChameleonKey.cs
- FileInfo.cs
- InternalMappingException.cs
- TextBox.cs
- RestClientProxyHandler.cs
- PeerHopCountAttribute.cs
- TransactionManagerProxy.cs
- SettingsPropertyIsReadOnlyException.cs
- PeerName.cs
- Validator.cs
- URIFormatException.cs
- XmlCustomFormatter.cs
- TransformerConfigurationWizardBase.cs
- DynamicValueConverter.cs
- AnnotationHelper.cs
- TextChangedEventArgs.cs
- TargetInvocationException.cs
- CommandValueSerializer.cs
- Profiler.cs
- BinHexEncoder.cs
- ConstraintStruct.cs
- SystemUdpStatistics.cs
- AsymmetricKeyExchangeFormatter.cs
- State.cs
- ReferencedAssembly.cs
- LayoutEditorPart.cs
- GAC.cs
- SlotInfo.cs
- XappLauncher.cs
- ConnectionPoint.cs
- ToolStripSeparator.cs
- Compiler.cs
- HtmlInputHidden.cs
- SerializationHelper.cs
- XmlSchemaInferenceException.cs
- WebPartVerb.cs
- ResourcePermissionBase.cs
- Helpers.cs
- TempEnvironment.cs
- MD5.cs
- WindowsScrollBarBits.cs
- TextEditorCharacters.cs
- httpstaticobjectscollection.cs
- DbInsertCommandTree.cs