Partilhar via


Entity.AddOrUpdateBusinessMetadataAsync Method

Definition

Overloads

AddOrUpdateBusinessMetadataAsync(String, IDictionary<String,IDictionary<String,BinaryData>>, Nullable<Boolean>, CancellationToken)

Add business metadata to an entity.

AddOrUpdateBusinessMetadataAsync(String, RequestContent, Nullable<Boolean>, RequestContext)

[Protocol Method] Add business metadata to an entity.

AddOrUpdateBusinessMetadataAsync(String, IDictionary<String,IDictionary<String,BinaryData>>, Nullable<Boolean>, CancellationToken)

Source:
Entity.cs

Add business metadata to an entity.

public virtual System.Threading.Tasks.Task<Azure.Response> AddOrUpdateBusinessMetadataAsync (string guid, System.Collections.Generic.IDictionary<string,System.Collections.Generic.IDictionary<string,BinaryData>> body, bool? overwrite = default, System.Threading.CancellationToken cancellationToken = default);
abstract member AddOrUpdateBusinessMetadataAsync : string * System.Collections.Generic.IDictionary<string, System.Collections.Generic.IDictionary<string, BinaryData>> * Nullable<bool> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response>
override this.AddOrUpdateBusinessMetadataAsync : string * System.Collections.Generic.IDictionary<string, System.Collections.Generic.IDictionary<string, BinaryData>> * Nullable<bool> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function AddOrUpdateBusinessMetadataAsync (guid As String, body As IDictionary(Of String, IDictionary(Of String, BinaryData)), Optional overwrite As Nullable(Of Boolean) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response)

Parameters

guid
String

The globally unique identifier of the entity.

body
IDictionary<String,IDictionary<String,BinaryData>>

BusinessMetadata payload.

overwrite
Nullable<Boolean>

Whether to overwrite the existing business metadata on the entity or not, default is false.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

guid or body is null.

guid is an empty string, and was expected to be non-empty.

Examples

This sample shows how to call AddOrUpdateBusinessMetadataAsync.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Entity client = new DataMapClient(endpoint, credential).GetEntityClient();

Response response = await client.AddOrUpdateBusinessMetadataAsync("<guid>", new Dictionary<string, IDictionary<string, BinaryData>>
{
    ["key"] = new Dictionary<string, BinaryData>
    {
        ["key"] = BinaryData.FromObjectAsJson(new object())
    }
});

This sample shows how to call AddOrUpdateBusinessMetadataAsync with all parameters.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Entity client = new DataMapClient(endpoint, credential).GetEntityClient();

Response response = await client.AddOrUpdateBusinessMetadataAsync("<guid>", new Dictionary<string, IDictionary<string, BinaryData>>
{
    ["key"] = new Dictionary<string, BinaryData>
    {
        ["key"] = BinaryData.FromObjectAsJson(new object())
    }
}, overwrite: true);

Applies to

AddOrUpdateBusinessMetadataAsync(String, RequestContent, Nullable<Boolean>, RequestContext)

Source:
Entity.cs

[Protocol Method] Add business metadata to an entity.

public virtual System.Threading.Tasks.Task<Azure.Response> AddOrUpdateBusinessMetadataAsync (string guid, Azure.Core.RequestContent content, bool? overwrite = default, Azure.RequestContext context = default);
abstract member AddOrUpdateBusinessMetadataAsync : string * Azure.Core.RequestContent * Nullable<bool> * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.AddOrUpdateBusinessMetadataAsync : string * Azure.Core.RequestContent * Nullable<bool> * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function AddOrUpdateBusinessMetadataAsync (guid As String, content As RequestContent, Optional overwrite As Nullable(Of Boolean) = Nothing, Optional context As RequestContext = Nothing) As Task(Of Response)

Parameters

guid
String

The globally unique identifier of the entity.

content
RequestContent

The content to send as the body of the request.

overwrite
Nullable<Boolean>

Whether to overwrite the existing business metadata on the entity or not, default is false.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

guid or content is null.

guid is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call AddOrUpdateBusinessMetadataAsync.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Entity client = new DataMapClient(endpoint, credential).GetEntityClient();

using RequestContent content = RequestContent.Create(new
{
    key = new
    {
        key = new object(),
    },
});
Response response = await client.AddOrUpdateBusinessMetadataAsync("<guid>", content);

Console.WriteLine(response.Status);

This sample shows how to call AddOrUpdateBusinessMetadataAsync with all parameters and request content.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
Entity client = new DataMapClient(endpoint, credential).GetEntityClient();

using RequestContent content = RequestContent.Create(new
{
    key = new
    {
        key = new object(),
    },
});
Response response = await client.AddOrUpdateBusinessMetadataAsync("<guid>", content, overwrite: true);

Console.WriteLine(response.Status);

Applies to