gautema / CQRSlite

A lightweight framework to help creating CQRS and Eventsourcing applications in C#
Other
1.1k stars 266 forks source link

Recreate data model from events after application restart #47

Closed jk1980 closed 7 years ago

jk1980 commented 7 years ago

Hi,

I'm stand in front of a problem. How to recreate data in data model from events after application restart? Let's take an webapp from sample as an example and assume that we store events in real DB but our data model on the read part stays as a InMemoryDatabase. After app restart I would like to take all events from DB and force them to event handlers to recreate data model and keep up-to-date InMemoryDatabase. How do you menage that? Any suggestions, ideas? Could be done automatically via CQRS Lite?

Thank you in advance

gautema commented 7 years ago

Do you want to use the InMemoryDb in a real application? There is no built in ways to rehydrate the datamodel or read models when the application starts. But I suppose you can load all events and send them to the event handlers if you want to.

jk1980 commented 7 years ago

Thank you for your answer. Finally I extend IEventStore to get historical data by given list of types.