SqlFacetAttribute クラス
アセンブリ: System.Data (system.data.dll 内)

<AttributeUsageAttribute(AttributeTargets.Property Or AttributeTargets.Field Or AttributeTargets.Parameter Or AttributeTargets.ReturnValue, AllowMultiple:=False, Inherited:=False)> _ Public Class SqlFacetAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter|AttributeTargets.ReturnValue, AllowMultiple=false, Inherited=false)] public class SqlFacetAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Property|AttributeTargets::Field|AttributeTargets::Parameter|AttributeTargets::ReturnValue, AllowMultiple=false, Inherited=false)] public ref class SqlFacetAttribute : public Attribute

SqlFacetAttribute は、void 以外の戻り値に対してのみ指定できます。
SqlFacetAttribute は、戻り値の型に関する情報を取り出す目的でのみ使用し、型に格納できる情報を制約することを意図したものではありません。したがって、"サイズが 2 文字である" ということを示す SqlFacetAttribute がフィールドに割り当てられていた場合、フィールド アクセス式によって返される SQL Server のデータ型が 2 というサイズを持つことを示すだけで、フィールドに代入できる値がこのファセットによって制約されるわけではありません。
以下の表は、特定のフィールド型の各種プロパティで有効な値をまとめたものです。表中の "Y" は、そのプロパティが有効なことを、また、"N" は、そのプロパティが無効であることを示します。
フィールド型に対して有効な SqlFacetAttribute 値を指定する必要があります。プロパティが無効である場合、そのプロパティに対して既定値以外の値を指定すると、型の登録時にエラーが報告されます。Precision プロパティおよび Scale プロパティの最大値は 38 です。MaxSize プロパティに指定できる値の範囲は、1 ~ 8000 (バイナリ データと非 Unicode データの場合)、1 ~ 4000 (Unicode データの場合)、または -1 になります。それ以外の値はすべて無効です。
型 | IsFixedLength | MaxSize | IsNullable | ||
---|---|---|---|---|---|
SqlBoolean | N | N | N | N | Y |
SqlByte | N | N | N | N | Y |
SqlInt16 | N | N | N | N | Y |
SqlInt32 | N | N | N | N | Y |
SqlInt64 | N | N | N | N | Y |
SqlSingle | N | N | N | N | Y |
SqlDouble | N | N | N | N | Y |
SqlDateTime | N | N | N | N | Y |
SqlMoney | N | N | N | N | Y |
SqlGuid | N | N | N | N | Y |
SqlDecimal | N | N | Y | Y | Y |
SqlString | Y | Y | N | N | Y |
SqlBinary | Y | Y | N | N | Y |
SqlXml | N | N | N | N | Y |
SqlBytes | Y | Y | N | N | Y |
SqlChars | Y | Y | N | N | Y |
N | N | N | N | Y | |
Y | Y | N | N | Y | |
Byte[] | Y | Y | N | N | Y |
Char[] | Y | Y | N | N | Y |
N | N | Y | Y | Y |

System.Attribute
Microsoft.SqlServer.Server.SqlFacetAttribute


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- SqlFacetAttribute クラスのページへのリンク