Class DataContainer
General purpose serializable data container.
Inheritance
Namespace: DNVGL.One.Compute.Core.FlowModel
Assembly: DNVGL.One.Compute.Core.dll
Syntax
public class DataContainer : object
Constructors
View SourceDataContainer()
Initializes a new instance of the DataContainer class.
Declaration
public DataContainer()
Remarks
The default constructor, if present, is used by JSON.NET when deserializing the object.
DataContainer(Object, ISerializationContext)
Initializes a new instance of the DataContainer class.
Declaration
public DataContainer(object data, ISerializationContext serializationContext = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | data | The application data (must be serializable to JSON). |
| ISerializationContext | serializationContext | The serialization context. |
Properties
View SourceContent
Gets or sets the content.
Declaration
public JToken Content { get; set; }
Property Value
| Type | Description |
|---|---|
| JToken | The content. |
ContentType
Gets or sets the type of the content.
Declaration
public string ContentType { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The type of the content. |
Remarks
From version 4.2 of OneCompute, this property is kept for backwards compatibility reasons to support roundtrip serialization between pre and post 4.2 versions of OneCompute. In the future, when all clients and workers use post 4.2 versions of OneCompute, this property can be removed in a final refactoring of DataContainer.
Version
Gets the DataContainer version.
Declaration
public int Version { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | The DataContainer version. |
Methods
View SourceGet(ISerializationContext, Type)
Gets or sets the data.
Declaration
public object Get(ISerializationContext serializationContext = null, Type type = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ISerializationContext | serializationContext | The serialization Context. |
| Type | type | The type of the data to retrieve. May be null. |
Returns
| Type | Description |
|---|---|
| System.Object | The data. |
Remarks
If type is null, ContentType property will be used to resolve the type.
Get<T>(ISerializationContext)
Gets this instance.
Declaration
public T Get<T>(ISerializationContext serializationContext = null)
where T : class
Parameters
| Type | Name | Description |
|---|---|---|
| ISerializationContext | serializationContext | The serialization Context. |
Returns
| Type | Description |
|---|---|
| T | Data as |
Type Parameters
| Name | Description |
|---|---|
| T | Type of data. |