Esempio n. 1
0
        private SagaContext(SagaId sagaId, string originator, IEnumerable <ISagaContextMetadata> metadata)
        {
            SagaId     = sagaId;
            Originator = originator;

            var areMetadataKeysUnique = metadata.GroupBy(m => m.Key).All(g => g.Count() is 1);

            if (!areMetadataKeysUnique)
            {
                throw new ChronicleException("Metadata keys are not unique");
            }

            Metadata = metadata.ToList().AsReadOnly();
        }
Esempio n. 2
0
 public virtual void Initialize(SagaId id, SagaStates state)
 => (Id, State) = (id, state);
Esempio n. 3
0
 public static ISagaContext Create(SagaId sagaId, string originator, IEnumerable <ISagaContextMetadata> metadata)
 => new SagaContext(sagaId, originator, metadata);