Table of Contents

Interface IAzureDigitalTwinsProvider

Namespace
Scaleout.Modules.DigitalTwin.Abstractions
Assembly
Scaleout.Modules.DigitalTwin.Abstractions.dll

Defines the methods available to ScaleOut Digital Twins for interacting with corresponding Azure Digital Twins (ADT) instances.

public interface IAzureDigitalTwinsProvider

Properties

IsActive

Indicates whether the ADT provider is active and can be used.

bool IsActive { get; }

Property Value

bool

Methods

GetInstanceAsync(string, string)

Returns a JSON-serialized digital twin instance with the Id instanceId, of type modelName.

Task<string> GetInstanceAsync(string modelName, string instanceId)

Parameters

modelName string

The name of the digital twins model.

instanceId string

The digital twin instance Id.

Returns

Task<string>

The JSON-serialized digital twin instance with the Id instanceId, of type modelName.

Exceptions

ArgumentNullException

modelName or instanceId is empty or null.

PersistenceProviderException

Failed to obtain the twin instance for the specified modelName.

GetInstanceIdsAsync(string)

Returns a list of digital twin instance identifiers associated with the specified modelName.

Task<List<string>> GetInstanceIdsAsync(string modelName)

Parameters

modelName string

The name of the digital twin model.

Returns

Task<List<string>>

The list of digital twin instance identifiers that are associated with the specified modelName.

Exceptions

ArgumentNullException

modelName is empty or null.

PersistenceProviderException

Failed to obtain the list of object instance identifiers for the specified modelName.

GetPropertyAsync<T>(string, string, string)

Gets the value of a property from a digital twin identified by instanceId and modelName.

Task<T> GetPropertyAsync<T>(string modelName, string instanceId, string propertyName)

Parameters

modelName string

The name of the digital twins model.

instanceId string

Digital twin instance Id.

propertyName string

Name of the property.

Returns

Task<T>

The current property's value.

Type Parameters

T

Type of the property.

GetPropertyListAsync(string)

Returns the list of digital twin's properties defined by the specified modelName.

Task<IEnumerable<(string propertyName, string propertyType)>> GetPropertyListAsync(string modelName)

Parameters

modelName string

The name of the digital twins model.

Returns

Task<IEnumerable<(string propertyName, string propertyType)>>

List of digital twin's properties.

Exceptions

ArgumentNullException

modelName is empty or null.

PersistenceProviderException

Failed to build the list of properties for the specified modelName.

UpdatePropertyAsync<T>(string, string, string, T)

Updates the value of a property on a digital twin identified by instanceId and modelName.

Task UpdatePropertyAsync<T>(string modelName, string instanceId, string propertyName, T propertyValue)

Parameters

modelName string

The name of the digital twins model.

instanceId string

Digital twin instance Id.

propertyName string

Name of the property.

propertyValue T

Property's new value.

Returns

Task

Type Parameters

T

Type of the property.