cqrs - NEventStore get projection which lists all aggregates of a given type -
i using irepository interface neventstore.domain project. create projection list of aggregates of given aggregate type. how go doing this:
so if have reportbatch
aggregate, looking list report batches have saved. how can accomplish this? barking wrong tree projections? should saving reportbatchlist aggregate when created
events reportbatch
.
should saving reportbatchlist aggregate when created events reportbatch.
no. should have projection writes read model each time receives created event. query read model list. read model database (sql or nosql), in-memory construct, text file, etc.
note not "a list of aggregates of given aggregate type". it's read model, , while read model may have knowledge of data generated aggregate, not directly represent aggregate.
event sourcing advanced form of command query responsibility segregation (cqrs), in writes (aggregates et al) , reads (projections , read models) conceptually separate.
Comments
Post a Comment