Example #1
0
        private ITransaction ToTransaction(NTccTransaction transaction)
        {
            if (transaction == null)
            {
                return(null);
            }

            return(_serializer.Deserialize <ITransaction>(transaction.Content));
        }
Example #2
0
        private void UpdateEntity(ITransaction transaction, NTccTransaction entity)
        {
            Check.NotNull(transaction, nameof(transaction));
            Check.NotNull(entity, nameof(entity));

            var currentVersion = transaction.Version;

            if (entity.Version != currentVersion)
            {
                throw new ConcurrencyTransactionException();
            }

            transaction.AddVersion();
            entity.CreateUtcTime     = transaction.CreateUtcTime;
            entity.LastUpdateUtcTime = transaction.LastUpdateUtcTime;
            entity.RetriedCount      = transaction.RetriedCount;
            entity.TransactionType   = transaction.TransactionType;
            entity.Status            = transaction.Status;
            entity.Version           = transaction.Version;
            entity.Content           = _serializer.Serialize(transaction);
        }