Class RoundtripDataFactory
Used to instantiate code generated classes that implement IRoundtripData
as generated by the Neon.ModelGen assembly.
Namespace: Neon.Data
Assembly: Neon.Common.dll
Syntax
public static class RoundtripDataFactory
Methods
CreateFrom(Type, JObject)
Constructs an instance of resultType from a JObject.
Declaration
public static object CreateFrom(Type resultType, JObject jObject)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | resultType | The result type. |
| JObject | jObject | The source JObject. |
Returns
| Type | Description |
|---|---|
| object | The new instance as an object. |
CreateFrom(Type, byte[])
Constructs an instance of resultType from a byte array.
Declaration
public static object CreateFrom(Type resultType, byte[] bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | resultType | The result type. |
| byte[] | bytes | The source bytes. |
Returns
| Type | Description |
|---|---|
| object | The new instance as an object. |
CreateFromAsync(Type, Stream, Encoding)
Constructs an instance of resultType from a Stream.
Declaration
public static Task<object> CreateFromAsync(Type resultType, Stream stream, Encoding encoding = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | resultType | The result type. |
| Stream | stream | The source Stream. |
| Encoding | encoding | Optionally specifies the encoding (defaults to UTF-8). |
Returns
| Type | Description |
|---|---|
| Task<object> | The new instance as an object. |
CreateFrom<TResult>(JObject)
Constructs an instance of TResult from a JObject.
Declaration
public static TResult CreateFrom<TResult>(JObject jObject)
Parameters
| Type | Name | Description |
|---|---|---|
| JObject | jObject | The source JObject. |
Returns
| Type | Description |
|---|---|
| TResult | The new |
Type Parameters
| Name | Description |
|---|---|
| TResult | The result type. |
CreateFrom<TResult>(byte[])
Constructs an instance of TResult from a byte array.
Declaration
public static TResult CreateFrom<TResult>(byte[] bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | bytes | The source bytes. |
Returns
| Type | Description |
|---|---|
| TResult | The new |
Type Parameters
| Name | Description |
|---|---|
| TResult | The result type. |
TryCreateFromAsync(Type, Stream, Encoding)
Attempts to construct an instance of resultType from a Stream.
Declaration
public static Task<Tuple<bool, object>> TryCreateFromAsync(Type resultType, Stream stream, Encoding encoding)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | resultType | The result type. |
| Stream | stream | The source Stream. |
| Encoding | encoding | Optionally specifies the encoding (defaults to UTF-8). |
Returns
| Type | Description |
|---|---|
| Task<Tuple<bool, object>> |
|