Skip to content

Instantly share code, notes, and snippets.


Christophe Geers geersch

View GitHub Profile
geersch / gist:edd75a600e86fb59130b
Last active August 29, 2015 14:01
#1 - Creating a projection
View gist:edd75a600e86fb59130b
// Compose a projection.
// - Tell what type of state the projection maintains (List<WizardActivity>)
var projection = Compose<List<WizardActivity>>.Projection()
.Initialize(() => new List<WizardActivity>()) // How do you want to initialize the state when you run the projection?
// When a wizard was started we want to know about it.
.When<WizardStarted>((@event, state) =>
var activity = new WizardActivity(@event.CorrelationId.Value, @event.TimeStamp);
if (!state.Contains(activity))