DigitalTwinsClient.UpdateComponentAsync Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Mises à jour propriétés d’un composant sur un jumeau numérique de façon asynchrone.
public virtual System.Threading.Tasks.Task<Azure.Response> UpdateComponentAsync (string digitalTwinId, string componentName, Azure.JsonPatchDocument jsonPatchDocument, Azure.ETag? ifMatch = default, System.Threading.CancellationToken cancellationToken = default);
abstract member UpdateComponentAsync : string * string * Azure.JsonPatchDocument * Nullable<Azure.ETag> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response>
override this.UpdateComponentAsync : string * string * Azure.JsonPatchDocument * Nullable<Azure.ETag> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function UpdateComponentAsync (digitalTwinId As String, componentName As String, jsonPatchDocument As JsonPatchDocument, Optional ifMatch As Nullable(Of ETag) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response)
Paramètres
- digitalTwinId
- String
Id du jumeau numérique.
- componentName
- String
Composant en cours de modification.
- jsonPatchDocument
- JsonPatchDocument
Opérations application/json-patch+json à effectuer sur le composant du jumeau numérique spécifié.
facultatif. Effectuez l’opération uniquement si l’ETag de l’entité correspond à cet ETag facultatif ou si * (All) est fourni.
- cancellationToken
- CancellationToken
Jeton d'annulation.
Retours
Réponse HTTP Response<T>. Cet objet de réponse inclut un en-tête HTTP qui vous donne l’ETag mis à jour pour cette ressource.
Exceptions
Exception qui capture les erreurs du service. Pour plus d’informations, consultez les ErrorCode propriétés et Status .
Exemples
// Update Component1 by replacing the property ComponentProp1 value,
// using an optional utility to build the payload.
var componentJsonPatchDocument = new JsonPatchDocument();
componentJsonPatchDocument.AppendReplace("/ComponentProp1", "Some new value");
await client.UpdateComponentAsync(basicDtId, "Component1", componentJsonPatchDocument);
Console.WriteLine($"Updated component for digital twin '{basicDtId}'.");
Remarques
Pour plus d’exemples, consultez nos exemples de dépôt.
S’applique à
Voir aussi
Azure SDK for .NET