public TagTransactionEntity(TagTransactionOperation operation, string channel, string alias, string username) { if (String.IsNullOrEmpty(alias)) { throw new ArgumentNullException(nameof(alias)); } if (String.IsNullOrEmpty(username)) { throw new ArgumentNullException(nameof(username)); } channel = String.IsNullOrEmpty(channel) ? "@" : channel; var now = DateTime.UtcNow.ToString("yyyy-MMdd-HHmm-ss"); var uniquifier = Uniquifier++; var transactionId = $"{username}|{now}-{uniquifier % 10000}"; this.PartitionKey = TagTransactionEntity.CalculatePartitionKey(channel, transactionId); this.RowKey = TagTransactionEntity.CalculateRowKey(); this.Channel = channel; this.Alias = alias; this.Username = username; this.Id = transactionId; this.Operation = operation.ToString(); this.StagedBlobUri = $"{channel}/{alias}/{transactionId}"; }
public bool TryUpdateOperation(TagTransactionOperation operation) { if (this.OperationValue != operation) { this.Operation = operation.ToString(); return(true); } return(false); }