Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DLinq / Dlinq / SqlClient / Query / SqlAggregateChecker.cs / 1305376 / SqlAggregateChecker.cs
using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Data.Linq; namespace System.Data.Linq.SqlClient { internal class SqlAggregateChecker { Visitor visitor; internal SqlAggregateChecker() { this.visitor = new Visitor(); } internal bool HasAggregates(SqlNode node) { visitor.hasAggregates = false; visitor.Visit(node); return visitor.hasAggregates; } class Visitor : SqlVisitor { internal bool hasAggregates; internal Visitor() { } internal override SqlExpression VisitSubSelect(SqlSubSelect ss) { return ss; } internal override SqlSource VisitSource(SqlSource source) { return source; } internal override SqlExpression VisitUnaryOperator(SqlUnary uo) { switch (uo.NodeType) { case SqlNodeType.Min: case SqlNodeType.Max: case SqlNodeType.Avg: case SqlNodeType.Sum: case SqlNodeType.Count: case SqlNodeType.LongCount: this.hasAggregates = true; return uo; default: return base.VisitUnaryOperator(uo); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Data.Linq; namespace System.Data.Linq.SqlClient { internal class SqlAggregateChecker { Visitor visitor; internal SqlAggregateChecker() { this.visitor = new Visitor(); } internal bool HasAggregates(SqlNode node) { visitor.hasAggregates = false; visitor.Visit(node); return visitor.hasAggregates; } class Visitor : SqlVisitor { internal bool hasAggregates; internal Visitor() { } internal override SqlExpression VisitSubSelect(SqlSubSelect ss) { return ss; } internal override SqlSource VisitSource(SqlSource source) { return source; } internal override SqlExpression VisitUnaryOperator(SqlUnary uo) { switch (uo.NodeType) { case SqlNodeType.Min: case SqlNodeType.Max: case SqlNodeType.Avg: case SqlNodeType.Sum: case SqlNodeType.Count: case SqlNodeType.LongCount: this.hasAggregates = true; return uo; default: return base.VisitUnaryOperator(uo); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- MaterializeFromAtom.cs
- SqlClientFactory.cs
- InsufficientMemoryException.cs
- FilterElement.cs
- SoundPlayer.cs
- SqlClientWrapperSmiStreamChars.cs
- PageEventArgs.cs
- IndicCharClassifier.cs
- XPathMessageFilterElementComparer.cs
- FormClosedEvent.cs
- InheritanceContextChangedEventManager.cs
- DeclarativeCatalogPart.cs
- RepeatEnumerable.cs
- RijndaelManagedTransform.cs
- Descriptor.cs
- ObjectIDGenerator.cs
- Decoder.cs
- GestureRecognitionResult.cs
- RegexWorker.cs
- PeerValidationBehavior.cs
- SessionStateModule.cs
- OptimalTextSource.cs
- SelectionChangedEventArgs.cs
- LinearGradientBrush.cs
- ColorTransform.cs
- SystemWebCachingSectionGroup.cs
- RequestUriProcessor.cs
- SimpleBitVector32.cs
- IRCollection.cs
- CustomSignedXml.cs
- XhtmlBasicObjectListAdapter.cs
- RenderingBiasValidation.cs
- WinOEToolBoxItem.cs
- Typography.cs
- SuppressMergeCheckAttribute.cs
- NoResizeSelectionBorderGlyph.cs
- RegexFCD.cs
- SecurityManager.cs
- ProcessHostServerConfig.cs
- ColumnWidthChangedEvent.cs
- SafeCryptoHandles.cs
- ViewStateException.cs
- DatePickerTextBox.cs
- WindowsFormsHelpers.cs
- IndependentAnimationStorage.cs
- assertwrapper.cs
- Opcode.cs
- Focus.cs
- BamlLocalizationDictionary.cs
- SubMenuStyle.cs
- XsltArgumentList.cs
- WebPartAuthorizationEventArgs.cs
- HeaderUtility.cs
- ReferentialConstraint.cs
- FormatConvertedBitmap.cs
- ColumnCollection.cs
- SymbolDocumentInfo.cs
- VisualBasicValue.cs
- CharacterBufferReference.cs
- HttpCachePolicy.cs
- OAVariantLib.cs
- StandardToolWindows.cs
- PipelineModuleStepContainer.cs
- PageCodeDomTreeGenerator.cs
- ToolStripItemEventArgs.cs
- TreeNodeStyleCollection.cs
- SafeTimerHandle.cs
- SegmentInfo.cs
- ParserContext.cs
- StorageMappingItemLoader.cs
- ServerIdentity.cs
- Style.cs
- TextCompositionEventArgs.cs
- DoWorkEventArgs.cs
- MemoryRecordBuffer.cs
- XmlNullResolver.cs
- _LazyAsyncResult.cs
- HttpFileCollection.cs
- IdentityModelDictionary.cs
- CodeVariableDeclarationStatement.cs
- ObjectStateEntry.cs
- MatrixAnimationBase.cs
- BamlRecordWriter.cs
- ComponentCollection.cs
- JapaneseLunisolarCalendar.cs
- MSHTMLHost.cs
- ZipIOCentralDirectoryBlock.cs
- sqlser.cs
- ConfigurationStrings.cs
- DesignerDataStoredProcedure.cs
- WebPartConnectVerb.cs
- LinkDescriptor.cs
- ModelTreeManager.cs
- TranslateTransform3D.cs
- RandomDelaySendsAsyncResult.cs
- ManipulationLogic.cs
- SamlAuthenticationStatement.cs
- HttpPostedFile.cs
- Variant.cs
- TypeSystemProvider.cs