protected override PersonEventStore GetEventStoreEntity(Person aggregateEntity, bool addIfNotFound)
        {
            var store = EventStores.FirstOrDefault(s => s.Id == aggregateEntity.Id);

            if (store == null && addIfNotFound)
            {
                store = new PersonEventStore {
                    Id = aggregateEntity.Id, Ssn = aggregateEntity.Ssn
                };
                EventStores.Add(store);
            }

            return(store);
        }
 public Person GetSnapshotById(int id, DateTime snapshot) => GetAggregateEntity(EventStores.FirstOrDefault(x => x.Id == id), snapshot);
 public Person GetById(int id) => GetAggregateEntity(EventStores.FirstOrDefault(x => x.Id == id));
 public Person GetBySsn(string ssn) => GetAggregateEntity(EventStores.FirstOrDefault(x => x.Ssn == ssn));
Example #5
0
 protected override PersonEventStore?GetEventStoreEntity(Person domainEntity) =>
 EventStores.FirstOrDefault(s => s.Id == domainEntity.Id);
 public PersonInMemoryEventStoreRepository(IEnumerable <PersonEventStore> eventStoreEntities)
 {
     EventStores.AddRange(eventStoreEntities);
 }
Example #7
0
 protected override void AddEventStoreEntity(PersonEventStore eventStoreEntity) =>
 EventStores.Add(eventStoreEntity);
Example #8
0
 public Person GetById(int id) => GetDomainEntity(EventStores.FirstOrDefault(x => x.Id == id));
Example #9
0
 public PersonInMemoryEventStoreRepository(IEnumerable <PersonEventStore> eventStoreEntities)
 {
     eventStoreEntities.ForEach(personEventStore => EventStores.Add(personEventStore));
 }
Example #10
0
 public Person GetSnapshotById(int id, DateTime snapshot) =>
 GetDomainEntity(EventStores.First(x => x.Id == id), snapshot);
Example #11
0
 public Person GetBySsn(string ssn) => GetDomainEntity(EventStores.First(x => x.Ssn == ssn));