Beispiel #1
0
        public void StoreOrigin(TransactionElement element)
        {
            if (element.ActionType == ActionType.Insert)
            {
                return;
            }

            var keyValuePair = element.Info.Repository.KeyValuePairOf(element.Entity, element.Info);
            var origin       = element.Info.Repository.Read(
                element.Info,
                new List <IDataCriterion>()
            {
                new DataCriterion()
                {
                    Name  = keyValuePair.Key,
                    Type  = element.Info.PersistedProperties.SingleOrDefault(x => x.Key == keyValuePair.Key).Value.PropertyType,
                    Value = keyValuePair.Value
                }
            })
                               .SingleOrDefault();

            if (origin == null)
            {
                throw new InvalidOperationException("Can`t get origin entity for update and delete operation in transaction");
            }

            if (!_originEntities.TryAdd(keyValuePair.Value, origin))
            {
                Abort();
            }
        }
Beispiel #2
0
 public void CompleteAction(TransactionElement element)
 {
     _completedElements.Enqueue(element);
 }