JsonExSerializer.SerializationContext Class Reference

Provides options controlling Serializing and Deserializing of objects. More...

List of all members.

Public Types

enum  ReferenceOption
enum  IgnoredPropertyOption
 Set of options for handling Ignored properties encountered upon Deserialization. More...

Public Member Functions

 SerializationContext ()
void SetJsonStrictOptions ()
 This will set the serializer to output in Json strict mode which will only output information compatible with the JSON standard.
void AddTypeBinding (Type t, string typeAlias)
 Adds a different binding for a type. When the type is encountered during serialization, the alias will be written out instead of the normal type info if a cast or type information is needed.
void ClearTypeBindings ()
 Clears all type bindings.
void RemoveTypeBinding (Type t)
 Removes a type binding.
void RemoveTypeBinding (string alias)
 Removes a type binding.
string GetTypeAlias (Type t)
 Looks up an alias for a given type that was registered with AddTypeBinding.
Type GetTypeBinding (string typeAlias)
 Looks up a type, given an alias for the type.
void RegisterTypeConverter (Type forType, IJsonTypeConverter converter)
 Register a type converter with the DefaultConverterFactory.
void RegisterTypeConverter (Type ForType, string PropertyName, IJsonTypeConverter Converter)
 Register a type converter with the DefaultConverterFactory.
void RegisterCollectionHandler (CollectionHandler handler)
 Registers a collection handler which provides support for a certain type or multiple types of collections.
TypeHandler GetTypeHandler (Type objectType)
void IgnoreProperty (Type objectType, string propertyName)
 Ignore a property to keep from being serialized, same as if the JsonExIgnore attribute had been set.

Properties

bool IsCompact [get, set]
 If true, string output will be as compact as possible with minimal spacing. Thus, cutting down on space. This option has no effect on Deserialization.
bool OutputTypeComment [get, set]
 If true a comment will be written out containing type information for the root object.
bool OutputTypeInformation [get, set]
 If set to true, type information will be written when necessary to properly deserialize the object. This is only when the type information derived from the serialized type will not be specific enough to deserialize correctly.
ReferenceOption ReferenceWritingType [get, set]
 Controls how references to previously serialized objects are written out. If the option is set to WriteIdentifier a reference identifier is written. The reference identifier is the path from the root to the first reference to the object. Example: this.SomeProp.1.MyClassVar; Otherwise a copy of the object is written unless a circular reference is detected, then this option controls how the circular reference is handled. If IgnoreCircularReferences is set, then null is written when a circular reference is detected. If ErrorCircularReferences is set, then an error will be thrown.
IgnoredPropertyOption IgnoredPropertyAction [get, set]
 Controls the action taken when an ignored property is encountered upon deserialization.
Serializer SerializerInstance [get, set]
 The current serializer instance that created and is using this context.
IDictionary Parameters [get]
 User defined parameters.
TypeHandlerFactory TypeHandlerFactory [get, set]
 Gets or sets the TypeHandlerFactory which is responsible for creating ITypeHandlers which manage type metadata.


Detailed Description

Provides options controlling Serializing and Deserializing of objects.


Member Enumeration Documentation

enum JsonExSerializer::SerializationContext::ReferenceOption

Enumerator:
WriteIdentifier 
IgnoreCircularReferences 
ErrorCircularReferences 

enum JsonExSerializer::SerializationContext::IgnoredPropertyOption

Set of options for handling Ignored properties encountered upon Deserialization.

Enumerator:
Ignore 
SetIfPossible 
ThrowException 


Constructor & Destructor Documentation

JsonExSerializer.SerializationContext.SerializationContext (  ) 


Member Function Documentation

void JsonExSerializer.SerializationContext.SetJsonStrictOptions (  ) 

This will set the serializer to output in Json strict mode which will only output information compatible with the JSON standard.

void JsonExSerializer.SerializationContext.AddTypeBinding ( Type  t,
string  typeAlias 
)

Adds a different binding for a type. When the type is encountered during serialization, the alias will be written out instead of the normal type info if a cast or type information is needed.

Parameters:
t the type object
typeAlias the type's alias

void JsonExSerializer.SerializationContext.ClearTypeBindings (  ) 

Clears all type bindings.

void JsonExSerializer.SerializationContext.RemoveTypeBinding ( Type  t  ) 

Removes a type binding.

Parameters:
t the bound type to remove

void JsonExSerializer.SerializationContext.RemoveTypeBinding ( string  alias  ) 

Removes a type binding.

Parameters:
alias the type alias to remove

string JsonExSerializer.SerializationContext.GetTypeAlias ( Type  t  ) 

Looks up an alias for a given type that was registered with AddTypeBinding.

Parameters:
t the type to lookup
Returns:
a type alias or null

Type JsonExSerializer.SerializationContext.GetTypeBinding ( string  typeAlias  ) 

Looks up a type, given an alias for the type.

Parameters:
typeAlias the alias to look up
Returns:
the type representing the alias or null

void JsonExSerializer.SerializationContext.RegisterTypeConverter ( Type  forType,
IJsonTypeConverter  converter 
)

Register a type converter with the DefaultConverterFactory.

Parameters:
forType the type to register
converter the converter

void JsonExSerializer.SerializationContext.RegisterTypeConverter ( Type  ForType,
string  PropertyName,
IJsonTypeConverter  Converter 
)

Register a type converter with the DefaultConverterFactory.

Parameters:
forType the property to register
converter the converter

void JsonExSerializer.SerializationContext.RegisterCollectionHandler ( CollectionHandler  handler  ) 

Registers a collection handler which provides support for a certain type or multiple types of collections.

Parameters:
handler the collection handler

TypeHandler JsonExSerializer.SerializationContext.GetTypeHandler ( Type  objectType  ) 

void JsonExSerializer.SerializationContext.IgnoreProperty ( Type  objectType,
string  propertyName 
)

Ignore a property to keep from being serialized, same as if the JsonExIgnore attribute had been set.

Parameters:
objectType the type that contains the property
propertyName the name of the property


Property Documentation

bool JsonExSerializer.SerializationContext.IsCompact [get, set]

If true, string output will be as compact as possible with minimal spacing. Thus, cutting down on space. This option has no effect on Deserialization.

bool JsonExSerializer.SerializationContext.OutputTypeComment [get, set]

If true a comment will be written out containing type information for the root object.

bool JsonExSerializer.SerializationContext.OutputTypeInformation [get, set]

If set to true, type information will be written when necessary to properly deserialize the object. This is only when the type information derived from the serialized type will not be specific enough to deserialize correctly.

ReferenceOption JsonExSerializer.SerializationContext.ReferenceWritingType [get, set]

Controls how references to previously serialized objects are written out. If the option is set to WriteIdentifier a reference identifier is written. The reference identifier is the path from the root to the first reference to the object. Example: this.SomeProp.1.MyClassVar; Otherwise a copy of the object is written unless a circular reference is detected, then this option controls how the circular reference is handled. If IgnoreCircularReferences is set, then null is written when a circular reference is detected. If ErrorCircularReferences is set, then an error will be thrown.

IgnoredPropertyOption JsonExSerializer.SerializationContext.IgnoredPropertyAction [get, set]

Controls the action taken when an ignored property is encountered upon deserialization.

Serializer JsonExSerializer.SerializationContext.SerializerInstance [get, set]

The current serializer instance that created and is using this context.

IDictionary JsonExSerializer.SerializationContext.Parameters [get]

User defined parameters.

TypeHandlerFactory JsonExSerializer.SerializationContext.TypeHandlerFactory [get, set]

Gets or sets the TypeHandlerFactory which is responsible for creating ITypeHandlers which manage type metadata.


Generated on Fri Feb 15 23:33:58 2008 for JsonExSerializer by  doxygen 1.5.2