コード例 #1
0
            public async Task Write(GrainStateRecord record)
            {
                var entity = record.Entity;

                if (logger.IsEnabled(LogLevel.Trace))
                {
                    logger.Trace((int)AzureProviderErrorCode.AzureTableProvider_Storage_Writing, "Writing: PartitionKey={0} RowKey={1} to Table={2} with ETag={3}", entity.PartitionKey, entity.RowKey, TableName, record.ETag);
                }
                string eTag = String.IsNullOrEmpty(record.ETag) ?
                              await tableManager.CreateTableEntryAsync(entity).ConfigureAwait(false) :
                              await tableManager.UpdateTableEntryAsync(entity, record.ETag).ConfigureAwait(false);

                record.ETag = eTag;
            }
コード例 #2
0
            public async Task Write(GrainStateRecord record)
            {
                GrainStateEntity entity = record.Entity;

                if (logger.IsVerbose3)
                {
                    logger.Verbose3((int)AzureProviderErrorCode.AzureTableProvider_Storage_Writing, "Writing: PartitionKey={0} RowKey={1} to Table={2} with ETag={3}", entity.PartitionKey, entity.RowKey, TableName, record.ETag);
                }
                string eTag = String.IsNullOrEmpty(record.ETag) ?
                              await tableManager.CreateTableEntryAsync(record.Entity) :
                              await tableManager.UpdateTableEntryAsync(entity, record.ETag);

                record.ETag = eTag;
            }
コード例 #3
0
 /// <summary>
 /// Try once to conditionally update a data entry in the Azure table. Returns false if etag does not match.
 /// </summary>
 private async Task <bool> TryUpdateTableEntryAsync(GossipTableEntry data, string dataEtag, [CallerMemberName] string operation = null)
 {
     return(await TryOperation(() => storage.UpdateTableEntryAsync(data, dataEtag), operation));
 }