Example name: Custom serializer
Description: Demonstrates the use of a custom serializer to control the serialization of a given server-side class' instances to the client side.
  • Note: This example requires registering the custom serializer with WebORB, using WebORB's management console as described here.
Prerequisites:
Client-side code: Browse  Download
Server-side code: Browse  Download
Feature availability:
  • WebORB for .NET Development Mode
  • WebORB for .NET Community Edition
  • WebORB for .NET Enterprise Edition
Run example:
Key points:
  • A custom serializer can modify any aspect of a given server-side class' serialization to the client.
  • In this sample, the custom serializer:
    • Changes the capitalization of property names, and
    • Obscures the returned personnel record's identity with the word 'SECRET' (see line 81 in the server-side code).
    • (See the server-side source code's 'employee database' (personnel[], line 11) for the employees' secret identities).
  • The custom serializer must be registered with WebORB using WebORB's management console, as described here.
  • If the serialization changes the names of the class' properties, then WebORB must be informed of the altered property names using the SetClientClassMemberNameAttribute attribute, as described in this sample.
   
Things to try:
  • Make mistakes on purpose, such as not registering the custom serializer with WebORB, or not using the SetClientClassMemberNameAttribute to advise WebORB of any altered property names, or spelling the (fully-qualified) class name of the serialized class incorrectly in the custom serializer's WriteObject() call.. What errors result?
See also:
Errata:
  • None yet known.