public override IItemData EvaluateUpdate(IItemData sourceItem, IItemData targetItem) { Assert.ArgumentNotNull(targetItem, "targetItemData"); Assert.ArgumentNotNull(sourceItem, "sourceItemData"); var deferredUpdateLog = new DeferredLogWriter <ISerializedAsMasterEvaluatorLogger>(); _logger.Evaluated(sourceItem ?? targetItem); var result = _parentConfiguration.Resolve <IPredicate>().Includes(targetItem); // TODO: In reality, `result` should never come back null here. With the current tests it does however, and it's // ^&*"$*£"&(* to change them if (ShouldUpdateExisting(sourceItem, targetItem, deferredUpdateLog, result?.FieldValueManipulator)) { using (new LogTransaction(_globalLogger)) { var changeHappened = _sourceDataStore.Save(targetItem, result?.FieldValueManipulator); if (changeHappened) { _logger.SerializedUpdatedItem(targetItem); deferredUpdateLog.ExecuteDeferredActions(_logger); } } return(targetItem); } return(null); }
public virtual IItemData EvaluateNewSerializedItem(IItemData newItemData) { Assert.ArgumentNotNull(newItemData, "newItem"); _logger.DeserializedNewItem(newItemData); _sourceDataStore.Save(newItemData); _logger.Evaluated(newItemData); return(newItemData); }
public virtual IItemData EvaluateNewSerializedItem(IItemData newItemData) { Assert.ArgumentNotNull(newItemData, "newItem"); _logger.DeserializedNewItem(newItemData); var result = _parentConfiguration.Resolve <IPredicate>().Includes(newItemData); // TODO: In reality, result should never come back null here. With the current tests it does however, and it's // ^&*"$*£"&(* to change them _sourceDataStore.Save(newItemData, result?.FieldValueManipulator); _logger.Evaluated(newItemData); return(newItemData); }
public override IItemData EvaluateUpdate(IItemData sourceItem, IItemData targetItem) { Assert.ArgumentNotNull(targetItem, "targetItemData"); Assert.ArgumentNotNull(sourceItem, "sourceItemData"); var deferredUpdateLog = new DeferredLogWriter <ISerializedAsMasterEvaluatorLogger>(); _logger.Evaluated(sourceItem ?? targetItem); if (ShouldUpdateExisting(sourceItem, targetItem, deferredUpdateLog)) { using (new LogTransaction(_globalLogger)) { _logger.SerializedUpdatedItem(targetItem); deferredUpdateLog.ExecuteDeferredActions(_logger); _sourceDataStore.Save(targetItem); } return(targetItem); } return(null); }
protected virtual void DoDeserialization(IItemData targetItem) { _sourceDataStore.Save(targetItem); }