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