Show / Hide Table of Contents

    Class SerializationExtensions

    Serialization extensions

    Inheritance
    Object
    SerializationExtensions
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: XData
    Assembly: XData.docfx.dll
    Syntax
    public static class SerializationExtensions

    Methods

    | Improve this Doc View Source

    ObjectToXml(Object)

    Serialize object data to Xml

    Declaration
    public static string ObjectToXml(object source)
    Parameters
    Type Name Description
    Object source

    Object to serialize

    Returns
    Type Description
    String

    Xml string

    | Improve this Doc View Source

    ReadXml<T>(String)

    Deserialize helper

    Declaration
    public static T ReadXml<T>(this string source)
    Parameters
    Type Name Description
    String source

    String contained serialized object

    Returns
    Type Description
    T

    De-serialized object

    Type Parameters
    Name Description
    T

    Object type

    | Improve this Doc View Source

    Restore<T>(T, SerializedData)

    Set serialized data to object

    Declaration
    public static void Restore<T>(this T obj, SerializedData data)
        where T : class, IDataObject, new()
    Parameters
    Type Name Description
    T obj

    Data object instance

    SerializedData data

    Serialized data

    Type Parameters
    Name Description
    T

    Data object type

    Exceptions
    Type Condition
    XDataQueryStructureException

    serialized data contains not mapped properties.

    XDataRuntimeException

    serialized data is null.

    XDataRuntimeException

    serialized data have a wrong type.

    See Also
    Serialize<T>(T)
    Serialize<T>(IEnumerable<T>)
    | Improve this Doc View Source

    Serialize<T>(T)

    Get serialized data from object

    Declaration
    public static SerializedData Serialize<T>(this T obj)
        where T : class, IDataObject, new()
    Parameters
    Type Name Description
    T obj

    Data object instance

    Returns
    Type Description
    SerializedData

    Serialized data

    Type Parameters
    Name Description
    T

    Data object type

    See Also
    Restore<T>(T, SerializedData)
    | Improve this Doc View Source

    Serialize<T>(IEnumerable<T>)

    Get serialized data from objects sequence

    Declaration
    public static SerializedData[] Serialize<T>(this IEnumerable<T> objects)
        where T : class, IDataObject, new()
    Parameters
    Type Name Description
    IEnumerable<T> objects

    Data objects sequence

    Returns
    Type Description
    SerializedData[]

    Serialized data

    Type Parameters
    Name Description
    T

    Data object type

    See Also
    Restore<T>(T, SerializedData)
    | Improve this Doc View Source

    Serialize<T>(IDataQuery<T>, TextWriter)

    Serialize data query helper

    Declaration
    public static void Serialize<T>(this IDataQuery<T> query, TextWriter writer)
        where T : class, IDataObject, new()
    Parameters
    Type Name Description
    IDataQuery<T> query

    Query

    TextWriter writer

    Writer to serialize

    Type Parameters
    Name Description
    T

    Data object type

    Exceptions
    Type Condition
    XDataRuntimeException

    Writer is null

    See Also
    GetRepository<T>(TextReader)
    | Improve this Doc View Source

    Serialize<T>(IRepository<T>, TextWriter)

    Serialize repository helper

    Declaration
    public static void Serialize<T>(this IRepository<T> repository, TextWriter writer)
        where T : class, IDataObject, new()
    Parameters
    Type Name Description
    IRepository<T> repository

    Repository

    TextWriter writer

    Writer to serialize

    Type Parameters
    Name Description
    T

    Data object type

    Exceptions
    Type Condition
    XDataRuntimeException

    Writer is null

    See Also
    GetRepository<T>(TextReader)
    | Improve this Doc View Source

    ToXml<T>(T)

    Serialize helper

    Declaration
    public static string ToXml<T>(this T source)
    Parameters
    Type Name Description
    T source

    Object to serialize

    Returns
    Type Description
    String

    Serialized collection

    Type Parameters
    Name Description
    T

    Object type

    • Improve this Doc
    • View Source
    Back to top Generated by DocFX