MFIdentiferToIDConverter Class

Converts an structure element reference value in a source JSON structure to an explicit ID in a target JSON structure. A ghost property will be added to the target JSON structure to preserve the original references used for the item. The ghost property will be named using the name of the property that contains the id value, followed by "-OriginalReferences". Typically the ghost properties can be converted back to references by the IDToMFIdentiferConverter. For example the source json: { ObjType: "ObjType1", Classes: [ "Class1", "Class2" ] } might get converted to a target like so: { objTypeID: 110, objTypeID-OriginalReferences: "ObjType1", classIDs: [ 2, 4 ], classIDs-OriginalReferences: [ "Class1", "Class2" ] }

Definition

Namespace: MFiles.VAF.Configuration.JsonMapping.Converters
Assembly: MFiles.VAF.Configuration (in MFiles.VAF.Configuration.dll) Version: 23.12.13247.3
C#
public class MFIdentiferToIDConverter : IJsonValueConverter
Inheritance
Object    MFIdentiferToIDConverter
Implements
IJsonValueConverter

Constructors

Properties

Resolver Used to resolve id's from references.
Type The type of structure element being IDed/Referenced.
WriteIdAsString Indicates whether we should write the id values as strings instead of integers.

Methods

ConvertValue Ensures that any non-numeric source values are resolved to an explicit id in the target value. Additionally a ghost value may be added to the target value's parent object to retain the original reference.
GetIdValue Gets a JSON compatible value from the id.
Invert Provides a reverse converter, for mapping values in the opposite direction.

See Also