Candor.WindowsAzure.Storage.Table.CloudTableSequenceIdOptimisticSyncStore.TryWrite C# (CSharp) Method

TryWrite() public method

Tries to write the current sequence value for a table.
public TryWrite ( OptimisticSyncData syncData ) : bool
syncData Candor.Data.OptimisticSyncData The table name and current value for the sequence. Also an ETag representing /// the latest reserved value retrieved. The ETag must match the curent stored value for the update/write /// to succeed.
return bool
        public bool TryWrite(OptimisticSyncData syncData)
        {
            var sequence = SequenceTableProxy.Get(syncData.TableName.GetValidPartitionKey(), syncData.TableName.GetValidRowKey()) ??
                           CreateSequenceFromSchema(syncData.TableName);

            if (sequence.ETag != syncData.ConcurrencyKey)
                return false; //caller can get data again and attempt a retry.

            sequence.Entity.Properties[PropertyFinalCachedId].StringValue = syncData.Data;
            SequenceTableProxy.Update(sequence);
            return true;
        }