예제 #1
0
 public Domain.Deelnemer.Deelnemer Get(Guid id)
 {
     var repo = new EventSourcedAggregateRepository<PensioenSysteem.Domain.Deelnemer.Deelnemer>(
         new FileEventStore(new RabbitMQEventPublisher()));
     var deelnemer = repo.GetById(id);
     return deelnemer;
 }
        public Domain.Deelnemer.Deelnemer Get(Guid id)
        {
            var repo = new EventSourcedAggregateRepository <PensioenSysteem.Domain.Deelnemer.Deelnemer>(
                new FileEventStore(new RabbitMQEventPublisher()));
            var deelnemer = repo.GetById(id);

            return(deelnemer);
        }
        public Domain.Arbeidsverhouding.Arbeidsverhouding Get(Guid id)
        {
            var repo = new EventSourcedAggregateRepository <PensioenSysteem.Domain.Arbeidsverhouding.Arbeidsverhouding>(
                new FileEventStore(new RabbitMQEventPublisher()));
            var arbeidsverhouding = repo.GetById(id);

            return(arbeidsverhouding);
        }
예제 #4
0
        public TAggregate GetById(Guid aggregateId)
        {
            TAggregate aggregate;

            if (cache.TryGetValue(aggregateId, out aggregate))
            {
                return(aggregate);
            }

            AggregateRepository <TAggregate> repository =
                new EventSourcedAggregateRepository <TAggregate>(aggregateEventStore);

            aggregate = repository.GetById(aggregateId);
            cache.TryAdd(aggregateId, aggregate);

            return(aggregate);
        }
예제 #5
0
        public HttpResponseMessage Verhuis(Guid id, [FromBody] VerhuisDeelnemerCommand command)
        {
            var repo = new EventSourcedAggregateRepository<PensioenSysteem.Domain.Deelnemer.Deelnemer>(
                new FileEventStore(new RabbitMQEventPublisher()));

            Domain.Deelnemer.Deelnemer deelnemer;
            try
            {
                deelnemer = repo.GetById(id);
            }
            catch (AggregateNotFoundException ex)
            {
                return new HttpResponseMessage(HttpStatusCode.NotFound);
            }

            deelnemer.Verhuis(command);

            repo.Save(deelnemer, command.Version);

            return new HttpResponseMessage(HttpStatusCode.OK);
        }
        public HttpResponseMessage Verhuis(Guid id, [FromBody] VerhuisDeelnemerCommand command)
        {
            var repo = new EventSourcedAggregateRepository <PensioenSysteem.Domain.Deelnemer.Deelnemer>(
                new FileEventStore(new RabbitMQEventPublisher()));

            Domain.Deelnemer.Deelnemer deelnemer;
            try
            {
                deelnemer = repo.GetById(id);
            }
            catch (AggregateNotFoundException ex)
            {
                return(new HttpResponseMessage(HttpStatusCode.NotFound));
            }

            deelnemer.Verhuis(command);

            repo.Save(deelnemer, command.Version);

            return(new HttpResponseMessage(HttpStatusCode.OK));
        }