Class DataContainer
General purpose serializable data container.
Inherited Members
Namespace: DNVGL.One.Compute.Core.FlowModel
Assembly: DNVGL.One.Compute.Core.dll
Syntax
[DataContract]
public class DataContainer
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 |
---|---|---|
object | data | The application data (must be serializable to JSON). |
ISerializationContext | serializationContext | The serialization context. |
Properties
View SourceContent
Gets or sets the content.
Declaration
[DataMember]
public JToken Content { get; set; }
Property Value
Type | Description |
---|---|
JToken | The content. |
ContentType
Gets or sets the type of the content.
Declaration
[DataMember]
public string ContentType { get; set; }
Property Value
Type | Description |
---|---|
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
[DataMember]
public int Version { get; }
Property Value
Type | Description |
---|---|
int | 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 |
---|---|
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. |