public async Task SaveStateAsync()

in src/Microsoft.Azure.WebJobs.Extensions.Dapr/Services/DaprServiceClient.cs [79:115]


        public async Task SaveStateAsync(
            string? daprAddress,
            string? stateStore,
            IEnumerable<DaprStateRecord> values,
            CancellationToken cancellationToken)
        {
            if (stateStore == null)
            {
                throw new ArgumentNullException(nameof(stateStore));
            }

            try
            {
                this.EnsureDaprAddress(ref daprAddress);

                var stringContent = new StringContent(
                    JsonSerializer.Serialize(values, JsonUtils.DefaultSerializerOptions),
                    Encoding.UTF8,
                    "application/json");
                var uri = $"{daprAddress}/v1.0/state/{Uri.EscapeDataString(stateStore)}";

                await this.daprClient.PostAsync(this.stateOutputLogger, uri, stringContent, cancellationToken);
            }
            catch (JsonException ex)
            {
                throw new DaprException(HttpStatusCode.BadRequest, ErrorCodes.ErrDaprBadRequest, "Failed to serialize. Reason: " + ex.Message, ex);
            }
            catch (Exception ex)
            {
                if (ex is DaprException || ex is DaprSidecarNotPresentException)
                {
                    throw;
                }

                throw new DaprException(HttpStatusCode.InternalServerError, ErrorCodes.ErrDaprRequestFailed, "An error occurred while saving state.", ex);
            }
        }