jonsequitur / Its.Cqrs

A set of libraries for CQRS and Event Sourcing, with a Domain-Driven Design flavor.
Other
77 stars 21 forks source link

If the Event Store is empty, the following line throws #210

Closed xavierjohn closed 6 years ago

xavierjohn commented 6 years ago

If the Event Store is empty, the following bold line throws.

private void InitializeEventStoreCatchupGoals() { using (var eventStore = createEventStoreDbContext()) { eventStoreTotalCount = eventStore.Events.Where(matchEvents, filter).Count(); initialCatchupIsDoneAfterEventId = eventStore.Events.Max(e => e.Id); } }

{"The cast to value type 'System.Int64' failed because the materialized value is null. Either the result type's generic parameter or the query must use a nullable type."}