SqlUserDefinedTypeAttribute Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Used to mark a type definition in an assembly as a user-defined type (UDT) in SQL Server. The properties on the attribute reflect the physical characteristics used when the type is registered with SQL Server. This class cannot be inherited.
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
- Inheritance
-
SqlUserDefinedTypeAttribute
- Attributes
The following example shows the UserDefinedType
attribute of the Point UDT. The UDT is byte-ordered, is named "Point", has a validation method named "ValidatePoint", and uses the native serialization format.
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 creates a user-defined type that is bound to the type definition that has the SqlUserDefinedTypeAttribute custom attribute. Every UDT must be annotated with this attribute. See CLR User-Defined Types for more information about UDTs, including an example of a UDT.
Sql |
A required attribute on a user-defined type (UDT), used to confirm that the given type is a UDT and to indicate the storage format of the UDT. |
Format |
The serialization format as a Format . |
Is |
Indicates whether the user-defined type is byte ordered. |
Is |
Indicates whether all instances of this user-defined type are the same length. |
Max |
The maximum size of the instance, in bytes. |
Name |
The SQL Server name of the user-defined type. |
Validation |
The name of the method used to validate instances of the user-defined type. |
Produkt | Versiounen |
---|---|
SqlClient .NET Core | 1.0, 1.1, 2.0, 2.1, 3.0, 3.1, 4.0, 4.1 |
SqlClient .NET Framework | 1.0, 1.1, 2.0, 2.1, 3.0, 3.1, 4.0, 4.1 |
SqlClient .NET Standard | 1.0, 1.1, 2.0, 2.1, 3.0, 3.1, 4.0, 4.1 |