Innovt Platform
Search Results for

    Show / Hide Table of Contents

    Class DeserializerFactory

    Represents a factory for deserializing JSON content into objects based on their registered type mappings.

    Inheritance
    object
    DeserializerFactory
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Innovt.Core.Serialization
    Assembly: Innovt.Core.dll
    Syntax
    public class DeserializerFactory

    Properties

    | Edit this page View Source

    Instance

    Gets the singleton instance of the DeserializerFactory.

    Declaration
    public static DeserializerFactory Instance { get; }
    Property Value
    Type Description
    DeserializerFactory

    Methods

    | Edit this page View Source

    AddMapping<T>(string)

    Adds a type mapping to the factory, associating a key with a specific .NET type.

    Declaration
    public DeserializerFactory AddMapping<T>(string key = null)
    Parameters
    Type Name Description
    string key

    The key used to identify the type mapping. If not provided, the full name of the type will be used as the key.

    Returns
    Type Description
    DeserializerFactory

    The current DeserializerFactory instance for method chaining.

    Type Parameters
    Name Description
    T

    The .NET type to be associated with the key.

    | Edit this page View Source

    Deserialize(string, string)

    Deserializes JSON content into an object of the registered type associated with the specified key.

    Declaration
    public object Deserialize(string key, string content)
    Parameters
    Type Name Description
    string key

    The key associated with the registered type mapping.

    string content

    The JSON content to deserialize.

    Returns
    Type Description
    object

    The deserialized object of the registered type, or null if the key is not found or the content is empty.

    | Edit this page View Source

    Deserialize<T>(string, string)

    Deserializes JSON content into an object of the registered type associated with the specified key.

    Declaration
    public T Deserialize<T>(string key, string content)
    Parameters
    Type Name Description
    string key

    The key associated with the registered type mapping.

    string content

    The JSON content to deserialize.

    Returns
    Type Description
    T

    The deserialized object of the specified type, or the default value for T if the key is not found or the content is empty.

    Type Parameters
    Name Description
    T

    The expected type of the deserialized object.

    Extension Methods

    Extensions.IsNull(object)
    Extensions.ToStringOrDefault(object)
    SimpleMapper.MapTo<T1>(object)
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX