SqlUserDefinedAggregateAttribute SqlUserDefinedAggregateAttribute SqlUserDefinedAggregateAttribute SqlUserDefinedAggregateAttribute Class


指示类型应注册为用户定义的聚合。 Indicates that the type should be registered as a user-defined aggregate. 该特性的属性反映了向 SQL Server 注册该类型时所使用的实体特性。 The properties on the attribute reflect the physical attributes used when the type is registered with SQL Server. 此类不能被继承。 This class cannot be inherited.

public ref class SqlUserDefinedAggregateAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct, AllowMultiple=false, Inherited=false)]
public sealed class SqlUserDefinedAggregateAttribute : Attribute
type SqlUserDefinedAggregateAttribute = class
    inherit Attribute
Public NotInheritable Class SqlUserDefinedAggregateAttribute
Inherits Attribute


下面的示例演示SqlUserDefinedAggregateAttribute的用户定义聚合的属性。The following example shows the SqlUserDefinedAggregateAttribute attribute for a user-defined aggregate. 聚合使用自定义序列化、 最大大小为 8000 个字节序列时,和是 null 值、 重复项,以及顺序不变。The aggregate uses custom serialization, has a maximum size of 8000 bytes when serialized, and is invariant to nulls, duplicates, and order.

using System;
using System.IO;
using System.Data.Sql;
using System.Data.SqlTypes;
using System.Text;
using Microsoft.SqlServer.Server;

   IsInvariantToNulls = true,			
   IsInvariantToDuplicates = false,		
   IsInvariantToOrder = false,			
   MaxByteSize = 8000)				
public class Concatenate : Microsoft.SqlServer.Server.IBinarySerialize
Imports System
Imports System.Data
Imports System.IO
Imports Microsoft.SqlServer.Server

<Serializable(), SqlUserDefinedAggregate(Microsoft.SqlServer.Server.Format.UserDefined, _ 
                                         IsInvariantToNulls:=True, _ 
                                         IsInvariantToDuplicates:=False, _
                                         IsInvariantToOrder:=False, _
                                         MaxByteSize:=8000)> _
Public Class Concatenate
    Implements Microsoft.SqlServer.Server.IBinarySerialize


SQL Server 将创建一个绑定到具有的类定义的用户定义聚合SqlUserDefinedAggregateAttribute自定义属性。SQL Server creates a user-defined aggregate that is bound to the class definition that has the SqlUserDefinedAggregateAttribute custom attribute. 每个用户定义聚合都必须具有此特性进行批注。Every user-defined aggregate must be annotated with this attribute.

用户定义聚合和示例的详细信息,请参阅 SQL Server 2005 联机丛书中的"CLR 用户定义聚合"。See "CLR User-Defined Aggregates" in SQL Server 2005 Books Online for more information on user-defined aggregates and examples.


SqlUserDefinedAggregateAttribute(Format) SqlUserDefinedAggregateAttribute(Format) SqlUserDefinedAggregateAttribute(Format) SqlUserDefinedAggregateAttribute(Format)

用户定义的聚合的一个必需特性,用于指示给定的类型为用户定义的聚合,以及用户定义的聚合的存储格式。 A required attribute on a user-defined aggregate, used to indicate that the given type is a user-defined aggregate and the storage format of the user-defined aggregate.


MaxByteSizeValue MaxByteSizeValue MaxByteSizeValue MaxByteSizeValue

在计算期间存储此聚合实例的状态所需的最大大小(以字节为单位)。 The maximum size, in bytes, required to store the state of this aggregate instance during computation.


Format Format Format Format

序列化格式为 Format 的值之一。 The serialization format as a Format.

IsInvariantToDuplicates IsInvariantToDuplicates IsInvariantToDuplicates IsInvariantToDuplicates

指示聚合是否与重复值无关。 Indicates whether the aggregate is invariant to duplicates.

IsInvariantToNulls IsInvariantToNulls IsInvariantToNulls IsInvariantToNulls

指示聚合是否与空值无关。 Indicates whether the aggregate is invariant to nulls.

IsInvariantToOrder IsInvariantToOrder IsInvariantToOrder IsInvariantToOrder

指示聚合是否与顺序无关。 Indicates whether the aggregate is invariant to order.

IsNullIfEmpty IsNullIfEmpty IsNullIfEmpty IsNullIfEmpty

指示在没有对任何值进行累积时聚合是否返回 null Indicates whether the aggregate returns null if no values have been accumulated.

MaxByteSize MaxByteSize MaxByteSize MaxByteSize

聚合实例的最大大小(以字节为单位)。 The maximum size, in bytes, of the aggregate instance.

Name Name Name Name

聚合的名称。 The name of the aggregate.

TypeId TypeId TypeId TypeId

在派生类中实现时,获取此 Attribute 的唯一标识符。 When implemented in a derived class, gets a unique identifier for this Attribute.

(Inherited from Attribute)


Equals(Object) Equals(Object) Equals(Object) Equals(Object)

返回一个值,该值指示此实例是否与指定的对象相等。 Returns a value that indicates whether this instance is equal to a specified object.

(Inherited from Attribute)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

返回此实例的哈希代码。 Returns the hash code for this instance.

(Inherited from Attribute)
GetType() GetType() GetType() GetType()

获取当前实例的 Type Gets the Type of the current instance.

(Inherited from Object)
IsDefaultAttribute() IsDefaultAttribute() IsDefaultAttribute() IsDefaultAttribute()

在派生类中重写时,指示此实例的值是否是派生类的默认值。 When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(Inherited from Attribute)
Match(Object) Match(Object) Match(Object) Match(Object)

当在派生类中重写时,返回一个指示此实例是否等于指定对象的值。 When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(Inherited from Attribute)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。 Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。 Returns a string that represents the current object.

(Inherited from Object)


_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

将一组名称映射为对应的一组调度标识符。 Maps a set of names to a corresponding set of dispatch identifiers.

(Inherited from Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

检索对象的类型信息,然后可以使用该信息获取接口的类型信息。 Retrieves the type information for an object, which can be used to get the type information for an interface.

(Inherited from Attribute)
_Attribute.GetTypeInfoCount(UInt32) _Attribute.GetTypeInfoCount(UInt32) _Attribute.GetTypeInfoCount(UInt32) _Attribute.GetTypeInfoCount(UInt32)

检索对象提供的类型信息接口的数量(0 或 1)。 Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Inherited from Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供对某一对象公开的属性和方法的访问。 Provides access to properties and methods exposed by an object.

(Inherited from Attribute)