Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load aggregate in specific version #570

Closed
douglas-tsc opened this issue Dec 11, 2018 · 2 comments
Closed

Load aggregate in specific version #570

douglas-tsc opened this issue Dec 11, 2018 · 2 comments
Milestone

Comments

@douglas-tsc
Copy link

It is possible load an aggregate in specific (old) version?

@rasmus
Copy link
Member

rasmus commented Dec 12, 2018

There's currently no API for that.

You could do something like this to achieve it though. (rough pseudo code from looking at the source)

// Load events representing version
var domainEvents = IEventStore.LoadEventsAsync(id)
domainEvents = domainEvents.Where(e => e.AggregateSequenceNumber < selected version).ToList()

// Apply to empty aggregate
var aggregate = IAggregateFactory.CreateNewAggregateAsync(id)
aggregate.ApplyEvents(domainEvents)

@rasmus rasmus added this to the 1.0 milestone Feb 25, 2022
@rasmus
Copy link
Member

rasmus commented Mar 3, 2022

Duplicate of #906

@rasmus rasmus marked this as a duplicate of #906 Mar 3, 2022
@rasmus rasmus closed this as completed Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants