3.1.5.1.6 Mapping Class Instances
A Class instance MUST be serialized by using the Class records specified in [MS-NRBF].
The first instance in the serialization stream of a Class in a Library other than the System Library SHOULD be serialized by using the ClassWithMembersAndTypes record. The ClassWithMembersAndTypes record allows a receiver to de-serialize the Class instance without requiring the receiver to have any out-of-band information about the Class. If the Member Type information is available to the receiver through an implementation-specific out-of-band mechanism, then a sender MAY perform serialization by using the ClassWithMembers record in order to reduce the size of data transmitted.
If the receiver is unable to process a ClassWithMembers record because it does not have the Member Type information for the record, the receiver MUST treat the case as a serialization error and abort processing. Sections 3.2.5.1.3 and 3.3.4.2.4 specify the error handling mechanism for the server and the client implementation, respectively.
Subsequent instances of the Class SHOULD be serialized by using the ClassWithId record but MAY be serialized like the first instance of the Class.<35>
The first instance in the serialization stream of a Class in the System Library SHOULD be serialized by using the SystemClassWithMembersAndTypes record. The SystemClassWithMembersAndTypes record allows a receiver to de-serialize the Class instance without requiring the receiver to have any out-of-band information about the Class. If the Member Type information is available to the receiver through an implementation-specific out-of-band mechanism, then a sender MAY perform serialization by using the SystemClassWithMembers record in order to reduce the size of data transmitted.
If the receiver is unable to process a SystemClassWithMembers record because it does not have the Member Type information for the record, the receiver MUST treat the case as a serialization error and abort processing. Sections 3.2.5.1.3 and 3.3.4.2.4 specify the error handling mechanism for the server and the client implementation respectively.
The first instance in the serialization stream of a Class in the System Library MAY instead be serialized using a ClassWithMembersAndTypes or ClassWithMembers record. In such cases the Library name MUST be serialized as specified in section 3.1.5.1.5 and the Library Identifier part of the Library name as specified in section 2.2.1.3 MUST be the name of the System Library.
Subsequent instances of the Class SHOULD be serialized using the ClassWithId record but MAY be serialized like the first instance of the Class.<36>
The names of the Class Members whose values are serialized are set in the MemberNames field of the ClassInfo structure of the Class records. For ClassWithMembersAndTypes and SystemClassWithMembersAndTypes records, the MemberTypeInfo field MUST be set by using the Member Types of the Class as specified in the MemberTypeInfo structure.
The values of all the Members MUST be serialized following this record. The record types that MUST be used for various types of Member values are as follows.
Data value type |
Binary record |
---|---|
MemberPrimitiveUnTyped, if MemberType was Primitive Type MemberPrimitiveTyped, if MemberType was System.Object |
|
String |
BinaryObjectString or MemberReferenceRecord |
Class |
MemberReference or Class records |
Member ReferenceRecord |
|
MemberReference or Class records |