示例#1
0
        internal async Task <Response <IReadOnlyDictionary <string, object> > > InsertInternalAsync(bool async, IDictionary <string, object> entity, CancellationToken cancellationToken)
        {
            Response <IReadOnlyDictionary <string, object> > response;

            if (async)
            {
                response = await _tableOperations.InsertEntityAsync(
                    _table,
                    tableEntityProperties : entity,
                    queryOptions : new QueryOptions()
                {
                    Format = _format
                },
                    cancellationToken : cancellationToken).ConfigureAwait(false);
            }
            {
                response = _tableOperations.InsertEntity(
                    _table,
                    tableEntityProperties: entity,
                    queryOptions: new QueryOptions()
                {
                    Format = _format
                },
                    cancellationToken: cancellationToken);
            }

            return(response);
        }
示例#2
0
 public virtual async Task <Response <IReadOnlyDictionary <string, object> > > InsertAsync(IDictionary <string, object> entity, CancellationToken cancellationToken = default) =>
 await _tableOperations.InsertEntityAsync(_table,
                                          tableEntityProperties : entity,
                                          queryOptions : new QueryOptions()
 {
     Format = _format
 },
                                          cancellationToken : cancellationToken).ConfigureAwait(false);
        public virtual async Task <Response <ReadOnlyDictionary <string, object> > > InsertAsync(IDictionary <string, object> entity, CancellationToken cancellationToken = default)
        {
            var response = await _tableOperations.InsertEntityAsync(_table,
                                                                    tableEntityProperties : entity.ToOdataAnnotatedDictionary(),
                                                                    queryOptions : new QueryOptions()
            {
                Format = _format
            },
                                                                    cancellationToken : cancellationToken).ConfigureAwait(false);

            var dict = new Dictionary <string, object>((IDictionary <string, object>)response.Value);

            dict.CastAndRemoveAnnotations();

            return(Response.FromValue(new ReadOnlyDictionary <string, object>(dict), response.GetRawResponse()));
        }