IBinarySerialize 接口

定义

为用户定义类型 (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 FormatUserDefinedor 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)

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

Write(BinaryWriter)

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

适用于