public Task <ISagaId> LocateSagaAsync(IDomainEvent domainEvent, CancellationToken cancellationToken) { var examId = domainEvent.GetIdentity() as ExamId; var examScoringSagaId = new ExamScoringSagaId($"examscoringsaga-{examId.GetGuid()}"); return(Task.FromResult <ISagaId>(examScoringSagaId)); }
private IIdentity GetIdentityTypeForEvent(IDomainEvent @event) { if (@event.GetAggregateEvent() is RoomOccupied roomOccupied) { return(roomOccupied.ReservationId); } return(@event.GetIdentity()); }
public Task <ISagaId> LocateSagaAsync(IDomainEvent domainEvent, CancellationToken cancellationToken) { var identity = domainEvent.GetIdentity().Value; if (identity.EndsWith(Guid.Empty.ToString())) { return(Task.FromResult <ISagaId>(null)); } return(Task.FromResult <ISagaId>(new TestSagaId($"saga-for-{identity}"))); }
public ResourceCreationSagaId LocateSaga(IDomainEvent domainEvent) { switch (domainEvent.GetAggregateEvent()) { case ResourceCreatedEvent _: return(new ResourceCreationSagaId($"{LocatorIdPrefix}-{domainEvent.GetIdentity()}")); default: throw new ArgumentException(nameof(domainEvent)); } }
public IDomainEvent <TAggregate, TIdentity> Upgrade <TAggregate, TIdentity>( IDomainEvent domainEvent, IAggregateEvent aggregateEvent) where TAggregate : IAggregateRoot <TIdentity> where TIdentity : IIdentity { return(Create <TAggregate, TIdentity>( aggregateEvent, domainEvent.Metadata, (TIdentity)domainEvent.GetIdentity(), domainEvent.AggregateSequenceNumber)); }
public Task <ISagaId> LocateSagaAsync(IDomainEvent domainEvent, CancellationToken cancellationToken) { var e = domainEvent.GetAggregateEvent(); if (e is BezahlungAngefordert angefordertEvent) { var bestellung = (BestellungId)domainEvent.GetIdentity(); ISagaId id = new BezahlungId(bestellung, angefordertEvent.Benutzer); return(Task.FromResult(id)); } if (e is Abgebucht || e is KontoEroeffnet) { return(Task.FromResult(this.CreateId(domainEvent))); } return(Task.FromResult(BezahlungId.Empty)); }
public Task <ISagaId> LocateSagaAsync(IDomainEvent domainEvent, CancellationToken cancellationToken) { var @event = domainEvent.GetAggregateEvent(); switch (@event) { case PatientIsRegisteredEvent _: { var patientId = (PatientId)domainEvent.GetIdentity(); var sagaId = GetSagaId(patientId); return(Task.FromResult <ISagaId>(sagaId)); } case TreatmentRoomIsReservedEvent treatmentRoomIsReserved: { var sagaId = new ConsultationSchedulerSagaId(treatmentRoomIsReserved.ReferenceId); return(Task.FromResult <ISagaId>(sagaId)); } case DoctorIsReservedEvent doctorIsReserved: { var sagaId = new ConsultationSchedulerSagaId(doctorIsReserved.ReferenceId); return(Task.FromResult <ISagaId>(sagaId)); } case ConsultationSchedulingIsCompletedEvent schedule: { var sagaId = GetSagaId(schedule.PatientId); return(Task.FromResult <ISagaId>(sagaId)); } default: { var patientId = domainEvent.Metadata["patientId"]; var sagaId = GetSagaId(patientId); return(Task.FromResult <ISagaId>(sagaId)); } } }
public Task <ISagaId> LocateSagaAsync(IDomainEvent domainEvent, CancellationToken cancellationToken) { var aggregateId = domainEvent.GetIdentity(); return(Task.FromResult <ISagaId>(new ThingySagaId($"saga-{aggregateId.Value}"))); }
public Task <ISagaId> LocateSagaAsync(IDomainEvent domainEvent, CancellationToken cancellationToken) { return(Task.FromResult <ISagaId>(new TestSagaId($"saga-for-{domainEvent.GetIdentity().Value}"))); }
public TIdentity LocateSaga(IDomainEvent domainEvent) { return(FindSagaIdInMetadata(domainEvent.Metadata.CorrelationIds, domainEvent.GetIdentity())); }
protected override System.String GetReadModelId(IDomainEvent domainEvent) { return(domainEvent.GetIdentity().Value); }
protected override string GetReadModelId(IDomainEvent domainEvent) => domainEvent.GetIdentity().Value;