DigitalTwinsClient.CreateModels Method

Definition

Creates one or many models synchronously.

public virtual Azure.Response<Azure.DigitalTwins.Core.DigitalTwinsModelData[]> CreateModels (System.Collections.Generic.IEnumerable<string> dtdlModels, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateModels : seq<string> * System.Threading.CancellationToken -> Azure.Response<Azure.DigitalTwins.Core.DigitalTwinsModelData[]>
override this.CreateModels : seq<string> * System.Threading.CancellationToken -> Azure.Response<Azure.DigitalTwins.Core.DigitalTwinsModelData[]>
Public Overridable Function CreateModels (dtdlModels As IEnumerable(Of String), Optional cancellationToken As CancellationToken = Nothing) As Response(Of DigitalTwinsModelData())

Parameters

dtdlModels
System.Collections.Generic.IEnumerable<System.String>

The set of models conforming to Digital Twins Definition Language (DTDL) v2 to create. Each string corresponds to exactly one model.

cancellationToken
System.Threading.CancellationToken

The cancellation token.

Returns

Response<DigitalTwinsModelData[]>

The created models and the http response Response<T>.

Exceptions

The exception that captures the errors from the service. Check the ErrorCode and Status properties for more details.

Remarks

Bulk model creation is useful when several models have references to each other. It simplifies creation for the client because otherwise the models would have to be created in a very specific order. The service evaluates all models to ensure all references are satisfied, and then accepts or rejects the set. So using this method, model creation is transactional.

For more samples, see our repo samples.

Applies to

See also