USER-DEFINED TYPES AND AGGREGATES Table 5-1: Requirements for

USER-DEFINED TYPES AND AGGREGATES Table 5-1: Requirements for User-Defined Type Implementation Form at INullableIBinarySerializableMaxBytesIsFixedLengthIsByteOrderedNull PropertyParse MethodReference TypesToString Method[Serializable] [StructLayout] UserDefined Y Y Y Y Y Y Y Y Y Y N Native Y N N N Y Y Y Y Y Y Y All classes that implement a user-defined type must be marked with the [Serializable] attribute. Regardless of the setting of the Format property, the maximum size of the byte stream used to save an instance of a user-defined type is 8,000 bytes. Any class used to implement a user-defined type must also implement the INullable interface, override the System.Object.ToString method, and implement a static read-only property named Null and a static method named Parse. Table 5-1 summarizes the requirements for classes used to implement a user-defined type. The requirements vary depending on whether Format.UserDefined or Format.Native is used. You can use this as a checklist when implementing a user-defined type. The first column on the left lists the two possible values for the Format property of the SqlUser DefinedTypeAttribute. The remaining columns show whether or not a particular feature is required for the implementation. For example, the IsFixedLengthproperty of the SqlUserDefinedTypeAttributeattribute is required when Format.UserDefined is used, but is not required when Format.Nativeis used. Listing 5-2 shows the skeleton implementation for the user-defined type we wish to create, LDim. Listing 5-2: Skeleton Implementation of LDim [Serializable] [SqlUserDefinedType( Format = Format.UserDefined, IsByteOrdered = true, IsFixedLength = true, MaxByteSize = 17 )]

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services

Bookmark the permalink.

Comments are closed.