Skip to content

Instantly share code, notes, and snippets.

@tomliversidge
Created April 21, 2017 06:49
Show Gist options
  • Save tomliversidge/c4593b8e59890bf08c173bcd51e76b04 to your computer and use it in GitHub Desktop.
Save tomliversidge/c4593b8e59890bf08c173bcd51e76b04 to your computer and use it in GitHub Desktop.
Example strategy usage
public async Task PersistEventAsync(object @event)
{
Index++;
await _state.PersistEventAsync(ActorId, Index, @event);
_actor.UpdateState(new PersistedEvent(@event, Index));
if (_snapshotStrategy.ShouldTakeSnapshot(Index))
{
await PersistSnapshotAsync(_actor.GetState());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment