Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Common / CommandTrees / Aggregates.cs / 1305376 / Aggregates.cs
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System;
using System.Data.Common;
using System.Collections.Generic;
using System.Data.Metadata.Edm;
using System.Data.Common.CommandTrees.Internal;
using System.Diagnostics;
namespace System.Data.Common.CommandTrees
{
///
/// Aggregates are pseudo-expressions. They look and feel like expressions, but
/// are severely restricted in where they can appear - only in the aggregates clause
/// of a group-by expression.
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db")]
public abstract class DbAggregate
{
private readonly DbExpressionList _args;
private readonly TypeUsage _type;
internal DbAggregate(TypeUsage resultType, DbExpressionList arguments)
{
Debug.Assert(resultType != null, "DbAggregate.ResultType cannot be null");
Debug.Assert(arguments != null, "DbAggregate.Arguments cannot be null");
Debug.Assert(arguments.Count == 1, "DbAggregate requires a single argument");
this._type = resultType;
this._args = arguments;
}
///
/// Gets the result type of this aggregate
///
public TypeUsage ResultType
{
get { return _type; }
}
///
/// Gets the list of expressions that define the arguments to the aggregate.
///
public IList Arguments { get { return _args; } }
}
///
/// The aggregate type that corresponds to exposing the collection of elements that comprise a group
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db")]
public sealed class DbGroupAggregate : DbAggregate
{
internal DbGroupAggregate(TypeUsage resultType, DbExpressionList arguments)
: base(resultType, arguments)
{
}
}
///
/// The aggregate type that corresponds to the invocation of an aggregate function.
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db")]
public sealed class DbFunctionAggregate : DbAggregate
{
private bool _distinct;
EdmFunction _aggregateFunction;
internal DbFunctionAggregate(TypeUsage resultType, DbExpressionList arguments, EdmFunction function, bool isDistinct)
: base(resultType, arguments)
{
Debug.Assert(function != null, "DbFunctionAggregate.Function cannot be null");
_aggregateFunction = function;
_distinct = isDistinct;
}
///
/// Gets a value indicating whether the aggregate function is applied in a distinct fashion
///
public bool Distinct { get { return _distinct; } }
///
/// Gets the method metadata that specifies the aggregate function to invoke.
///
public EdmFunction Function { get { return _aggregateFunction; } }
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
using System;
using System.Data.Common;
using System.Collections.Generic;
using System.Data.Metadata.Edm;
using System.Data.Common.CommandTrees.Internal;
using System.Diagnostics;
namespace System.Data.Common.CommandTrees
{
///
/// Aggregates are pseudo-expressions. They look and feel like expressions, but
/// are severely restricted in where they can appear - only in the aggregates clause
/// of a group-by expression.
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db")]
public abstract class DbAggregate
{
private readonly DbExpressionList _args;
private readonly TypeUsage _type;
internal DbAggregate(TypeUsage resultType, DbExpressionList arguments)
{
Debug.Assert(resultType != null, "DbAggregate.ResultType cannot be null");
Debug.Assert(arguments != null, "DbAggregate.Arguments cannot be null");
Debug.Assert(arguments.Count == 1, "DbAggregate requires a single argument");
this._type = resultType;
this._args = arguments;
}
///
/// Gets the result type of this aggregate
///
public TypeUsage ResultType
{
get { return _type; }
}
///
/// Gets the list of expressions that define the arguments to the aggregate.
///
public IList Arguments { get { return _args; } }
}
///
/// The aggregate type that corresponds to exposing the collection of elements that comprise a group
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db")]
public sealed class DbGroupAggregate : DbAggregate
{
internal DbGroupAggregate(TypeUsage resultType, DbExpressionList arguments)
: base(resultType, arguments)
{
}
}
///
/// The aggregate type that corresponds to the invocation of an aggregate function.
///
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db")]
public sealed class DbFunctionAggregate : DbAggregate
{
private bool _distinct;
EdmFunction _aggregateFunction;
internal DbFunctionAggregate(TypeUsage resultType, DbExpressionList arguments, EdmFunction function, bool isDistinct)
: base(resultType, arguments)
{
Debug.Assert(function != null, "DbFunctionAggregate.Function cannot be null");
_aggregateFunction = function;
_distinct = isDistinct;
}
///
/// Gets a value indicating whether the aggregate function is applied in a distinct fashion
///
public bool Distinct { get { return _distinct; } }
///
/// Gets the method metadata that specifies the aggregate function to invoke.
///
public EdmFunction Function { get { return _aggregateFunction; } }
}
}
// 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
- HttpFormatExtensions.cs
- FontConverter.cs
- HtmlUtf8RawTextWriter.cs
- KnownTypes.cs
- CompositionTarget.cs
- PrintingPermission.cs
- ToolStripItemBehavior.cs
- DataGrid.cs
- ParameterModifier.cs
- SqlConnectionStringBuilder.cs
- EnumDataContract.cs
- HandlerBase.cs
- ActiveXHost.cs
- WsiProfilesElement.cs
- GetKeyedHashRequest.cs
- TreeViewImageIndexConverter.cs
- DependencyStoreSurrogate.cs
- dataobject.cs
- Compiler.cs
- FormViewModeEventArgs.cs
- PrivateFontCollection.cs
- EditorPartChrome.cs
- DataDocumentXPathNavigator.cs
- XmlEnumAttribute.cs
- SourceFilter.cs
- FileSecurity.cs
- BitmapPalette.cs
- MaskInputRejectedEventArgs.cs
- UInt16Storage.cs
- TextWriter.cs
- SecurityKeyType.cs
- IndentedTextWriter.cs
- JapaneseLunisolarCalendar.cs
- ImageCreator.cs
- RefExpr.cs
- DesigntimeLicenseContextSerializer.cs
- XmlLoader.cs
- Size3D.cs
- ValidationErrorEventArgs.cs
- AudienceUriMode.cs
- AllMembershipCondition.cs
- MarshalByRefObject.cs
- SizeAnimationUsingKeyFrames.cs
- OletxResourceManager.cs
- KnownColorTable.cs
- BreakRecordTable.cs
- GetWinFXPath.cs
- Pkcs9Attribute.cs
- PackWebRequest.cs
- ToolboxComponentsCreatedEventArgs.cs
- ConditionBrowserDialog.cs
- ISessionStateStore.cs
- ProfileBuildProvider.cs
- DependencyPropertyConverter.cs
- AsyncPostBackErrorEventArgs.cs
- CornerRadiusConverter.cs
- LinearGradientBrush.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- SolidColorBrush.cs
- TextPattern.cs
- OleDbPropertySetGuid.cs
- StickyNoteAnnotations.cs
- CompiledQuery.cs
- PerformanceCounter.cs
- Listen.cs
- FieldToken.cs
- MappingItemCollection.cs
- DPTypeDescriptorContext.cs
- NativeMethods.cs
- ComponentManagerBroker.cs
- TraceSwitch.cs
- Dynamic.cs
- ColumnResizeUndoUnit.cs
- ToolboxBitmapAttribute.cs
- PeerApplicationLaunchInfo.cs
- UnauthorizedAccessException.cs
- RelatedEnd.cs
- SQLInt16.cs
- MediaPlayer.cs
- WebPartDescription.cs
- RestClientProxyHandler.cs
- QueryHandler.cs
- FSWPathEditor.cs
- XmlBaseReader.cs
- SessionState.cs
- ExtensionDataReader.cs
- GridViewRowPresenterBase.cs
- ManipulationVelocities.cs
- SocketException.cs
- NullableDecimalMinMaxAggregationOperator.cs
- UncommonField.cs
- ImmutableClientRuntime.cs
- AccessText.cs
- BaseParser.cs
- RecordConverter.cs
- UdpChannelListener.cs
- Select.cs
- Subset.cs
- MarshalByValueComponent.cs
- TreeViewEvent.cs