Skip to content

Ability to rebuild an individual stream's projections #1333

Answered by malscent
malscent asked this question in Q&A
Discussion options

You must be logged in to vote

Found a work around. If you aggregate the stream, then call store on the session and save changes, the projection will be updated. I don't know if this satisfies all use cases, but it worked for us:

public async Task<T> RefreshProjection<T>(Guid StreamId) where T: class, IProjection, new()
        {
            if (StartSession())
            {
                T stream = await _session.Events.AggregateStreamAsync<T>(StreamId);
                _session.Store<T>(stream);
                await _session.SaveChangesAsync();
                return stream;
            }
            else
            {
                throw new UnableToStartSessionException("An error occurred while attempting to c…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mysticmind
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant
Converted from issue

This discussion was converted from issue #1333 on November 28, 2020 07:51.