Task IEventHandler <IncomeWhenChanged> .HandleAsync(IncomeWhenChanged payload) { return(UpdateState(() => { When = payload.When; })); }
public async Task HandleAsync(IncomeWhenChanged payload) { using (ReadModelContext db = dbFactory.Create()) { IncomeEntity entity = await db.Incomes.FindAsync(payload.AggregateKey.AsGuidKey().Guid); if (entity != null) { entity.When = payload.When; await db.SaveChangesAsync(); } } }
Task IEventHandler <IncomeWhenChanged> .HandleAsync(IncomeWhenChanged payload) => RaiseEvent(payload);