Class AbstractionMap
Provides an interface to map abstract and interface types to concrete types for object instantiation during deserialization.
Inheritance
Inherited Members
Namespace: Manatee.Json.Serialization
Assembly: Manatee.Json.dll
Syntax
public class AbstractionMap
Constructors
| Improve this Doc View SourceAbstractionMap()
Creates a new AbstractionMap instance.
Declaration
public AbstractionMap()
AbstractionMap(AbstractionMap)
Creates a new AbstractionMap instance using another as a basis.
Declaration
public AbstractionMap(AbstractionMap other)
Parameters
Type | Name | Description |
---|---|---|
AbstractionMap | other |
Properties
| Improve this Doc View SourceDefault
Provides a default abstraction map for new JsonSerializer instances.
Declaration
public static AbstractionMap Default { get; }
Property Value
Type | Description |
---|---|
AbstractionMap |
Methods
| Improve this Doc View SourceGetMap(Type)
Retrieves the map setting for an abstraction type.
Declaration
public Type GetMap(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The abstraction type. |
Returns
Type | Description |
---|---|
System.Type | The mapped type if a mapping exists; otherwise the abstraction type. |
Map<TAbstract, TConcrete>(MapBaseAbstractionBehavior)
Applies a mapping from an abstraction to a concrete type.
Declaration
public void Map<TAbstract, TConcrete>(MapBaseAbstractionBehavior mappingBehavior = MapBaseAbstractionBehavior.Unmapped)
where TConcrete : TAbstract, new()
Parameters
Type | Name | Description |
---|---|---|
MapBaseAbstractionBehavior | mappingBehavior | The mapping behavior. |
Type Parameters
Name | Description |
---|---|
TAbstract | The abstract type. |
TConcrete | The concrete type. |
Exceptions
Type | Condition |
---|---|
JsonTypeMapException<TAbstract, TConcrete> | Thrown if TConcrete is an abstract class or an interface. |
MapGeneric(Type, Type, MapBaseAbstractionBehavior)
Applies a mapping from an open generic abstraction to an open generic concrete type.
Declaration
public void MapGeneric(Type tAbstract, Type tConcrete, MapBaseAbstractionBehavior mappingBehavior = MapBaseAbstractionBehavior.Unmapped)
Parameters
Type | Name | Description |
---|---|---|
System.Type | tAbstract | The abstract type. |
System.Type | tConcrete | The concrete type. |
MapBaseAbstractionBehavior | mappingBehavior | The mapping behavior. |
Exceptions
Type | Condition |
---|---|
JsonTypeMapException | Thrown if |
RemoveMap<TAbstract>(Boolean)
Removes a previously-assigned mapping.
Declaration
public void RemoveMap<TAbstract>(bool removeRelated = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | removeRelated | Optionally removes mappings of base and related interface types. |
Type Parameters
Name | Description |
---|---|
TAbstract | The type to remove. |