Class SerializationExtensions
Serialization extensions
Inherited Members
Namespace: XData
Assembly: XData.docfx.dll
Syntax
public static class SerializationExtensions
Methods
| Improve this Doc View SourceObjectToXml(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 |
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 |
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
| Improve this Doc View SourceSerialize<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
| Improve this Doc View SourceSerialize<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
| Improve this Doc View SourceSerialize<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
| Improve this Doc View SourceSerialize<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
| Improve this Doc View SourceToXml<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 |