Show / Hide Table of Contents

Class DataContainer

General purpose serializable data container.

Inheritance
object
DataContainer
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DNVGL.One.Compute.Core.FlowModel
Assembly: DNVGL.One.Compute.Core.dll
Syntax
[DataContract]
public class DataContainer

Constructors

View Source

DataContainer()

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.

View Source

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 Source

Content

Gets or sets the content.

Declaration
[DataMember]
public JToken Content { get; set; }
Property Value
Type Description
JToken

The content.

View Source

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.

View Source

Version

Gets the DataContainer version.

Declaration
[DataMember]
public int Version { get; }
Property Value
Type Description
int

The DataContainer version.

Methods

View Source

Get(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.

View Source

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 T.

Type Parameters
Name Description
T

Type of data.

  • View Source
In this article
Back to top Copyright © DNV AS. All rights reserved.