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
- OperationAbortedException.cs
- StreamUpdate.cs
- DeploymentExceptionMapper.cs
- Light.cs
- TimeoutException.cs
- CalendarDateChangedEventArgs.cs
- SmtpDateTime.cs
- panel.cs
- ProviderConnectionPointCollection.cs
- Window.cs
- CollectionViewSource.cs
- ExpressionPrefixAttribute.cs
- MDIControlStrip.cs
- EncoderNLS.cs
- String.cs
- CharacterBufferReference.cs
- ParseHttpDate.cs
- BufferModeSettings.cs
- CodeSubDirectory.cs
- ProxyWebPart.cs
- GenericWebPart.cs
- SyncOperationState.cs
- _SslStream.cs
- Thumb.cs
- ContentDisposition.cs
- SecurityKeyType.cs
- PeerNameResolver.cs
- VerificationAttribute.cs
- DataBoundControlHelper.cs
- FixedBufferAttribute.cs
- UnmanagedMarshal.cs
- safePerfProviderHandle.cs
- XmlWrappingWriter.cs
- WebPartsSection.cs
- HebrewCalendar.cs
- FtpCachePolicyElement.cs
- ColorPalette.cs
- BufferAllocator.cs
- ControlTemplate.cs
- Schedule.cs
- DataSysAttribute.cs
- PhysicalOps.cs
- CalendarDesigner.cs
- TextParagraphCache.cs
- ToolboxItemFilterAttribute.cs
- StorageModelBuildProvider.cs
- BinaryCommonClasses.cs
- BamlBinaryReader.cs
- DbModificationCommandTree.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- SurrogateSelector.cs
- FixedDSBuilder.cs
- HwndTarget.cs
- ObjectDataSourceDisposingEventArgs.cs
- DataControlReferenceCollection.cs
- HtmlInputButton.cs
- WebPartTransformer.cs
- RepeatEnumerable.cs
- X509ChainPolicy.cs
- SchemaLookupTable.cs
- MenuItemAutomationPeer.cs
- ArithmeticException.cs
- GlyphRunDrawing.cs
- OleDbPropertySetGuid.cs
- UnmanagedMemoryStream.cs
- DefaultTextStore.cs
- ExceptionTranslationTable.cs
- BuildProviderAppliesToAttribute.cs
- Rect.cs
- CompressEmulationStream.cs
- RouteItem.cs
- SerialErrors.cs
- TdsParserSessionPool.cs
- AssemblySettingAttributes.cs
- ElementFactory.cs
- TerminatorSinks.cs
- Events.cs
- FieldAccessException.cs
- OlePropertyStructs.cs
- HttpApplicationStateWrapper.cs
- Win32KeyboardDevice.cs
- OperationSelectorBehavior.cs
- RotateTransform3D.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- selecteditemcollection.cs
- QueryPageSettingsEventArgs.cs
- TransformedBitmap.cs
- OutputScope.cs
- LineGeometry.cs
- LinqDataSourceUpdateEventArgs.cs
- DbProviderFactories.cs
- ToolStripStatusLabel.cs
- HtmlHead.cs
- StoreContentChangedEventArgs.cs
- BamlWriter.cs
- RequiredAttributeAttribute.cs
- StringWriter.cs
- ConfigurationFileMap.cs
- RijndaelManagedTransform.cs
- TextViewDesigner.cs