SqlUserDefinedTypeAttribute クラス

定義

アセンブリ内の型定義をユーザー定義型 (UDT) として宣言して、SQL Server に登録する場合に使用します。 この属性には、型を SQL Server に登録する際に使用される物理的な特性を反映した、いくつかのプロパティが格納されます。 このクラスは継承できません。

public ref class SqlUserDefinedTypeAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct, AllowMultiple=false, Inherited=true)]
public sealed class SqlUserDefinedTypeAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Struct, AllowMultiple=false, Inherited=true)>]
type SqlUserDefinedTypeAttribute = class
    inherit Attribute
Public NotInheritable Class SqlUserDefinedTypeAttribute
Inherits Attribute
継承
SqlUserDefinedTypeAttribute
属性

次の例は、 UserDefinedType Point UDT の属性を示しています。 UDT はバイト順で、名前は "Point" で、検証メソッドは "ValidatePoint" で、ネイティブシリアル化形式を使用します。

using Microsoft.Data.SqlClient.Server;
using System.Data.SqlTypes;
using System.Text;

[Serializable]
[Microsoft.Data.SqlClient.Server.SqlUserDefinedType(Format.Native,
     IsByteOrdered = true,
     Name = "Point", ValidationMethodName = "ValidatePoint")]
public struct Point : INullable
{

注釈

SQL Serverは、カスタム属性を持つ型定義にバインドされたユーザー定義型をSqlUserDefinedTypeAttribute作成します。 すべての UDT には、この属性を使用して注釈を付ける必要があります。 UDT の例など、UDT の詳細については、「 CLR User-Defined 型 」を参照してください。

コンストラクター

名前 説明
SqlUserDefinedTypeAttribute(Format)

ユーザー定義型 (UDT) に対する必須の属性。型が UDT であり、UDT のストレージ形式を持つことを示します。

プロパティ

名前 説明
Format

としての Format シリアル化形式。

IsByteOrdered

ユーザー定義型がバイト順の並びを持つかどうかを示します。

IsFixedLength

このユーザー定義型のすべてのインスタンスが同じ長さを持つかどうかを示します。

MaxByteSize

インスタンスのバイト単位の最大サイズ。

Name

ユーザー定義型の SQL Server 名。

ValidationMethodName

ユーザー定義型のインスタンスを検証する際に使用するメソッドの名前。

適用対象