IBinarySerialize IBinarySerialize IBinarySerialize IBinarySerialize Interface


为用户定义类型 (UDT) 和用户定义聚合的序列化和反序列化提供自定义实现。Provides custom implementation for user-defined type (UDT) and user-defined aggregate serialization and deserialization.

public interface class IBinarySerialize
public interface IBinarySerialize
type IBinarySerialize = interface
Public Interface IBinarySerialize


用户定义类型 (Udt) 和用户定义聚合所需定义存储格式,可以是FormatNativeUser-defined types (UDTs) and user-defined aggregates are required to define a storage format, which can be either Format.Native Format.UserDefinedor Format.UserDefined.

Format.NativeFormat.Native 允许 SQL Server 处理的序列化和反序列化自动,但该格式具有限制,它可以处理的类型的类型。allows SQL Server to handle serialization and deserialization automatically, but the format has restrictions on the kind of types it can handle. Format.UserDefinedFormat.UserDefined 允许用户定义类型和聚合以处理其自己的序列化。allows user-defined types and aggregates to handle their own serialization. 用户定义类型和聚合必须标记有FormatUserDefinedUser-defined types and aggregates must be marked with Format.UserDefined 在中SqlUserDefinedTypeSqlUserDefinedAggregate属性,并且必须实现IBinarySerialize接口。in the SqlUserDefinedType or SqlUserDefinedAggregate attribute, and must implement the IBinarySerialize interface.

请注意,即使使用自定义序列化,每个实例的总大小必须在允许的限制,当前 8000 个字节的最大。Note that even with custom serialization, the total size of each instance must be under the maximum allowed limit, currently 8000 bytes.


Read(BinaryReader) Read(BinaryReader) Read(BinaryReader) Read(BinaryReader)

从用户定义类型 (UDT) 或用户定义聚合的二进制格式生成用户定义的类型或用户定义的聚合。Generates a user-defined type (UDT) or user-defined aggregate from its binary form.

Write(BinaryWriter) Write(BinaryWriter) Write(BinaryWriter) Write(BinaryWriter)

将用户定义的类型 (UDT) 或用户定义的聚合转换为其二进制格式,以便保留。Converts a user-defined type (UDT) or user-defined aggregate into its binary format so that it may be persisted.