public void Handle(NoteTextChanged evnt) { using (var context = new ReadModelContainer()) { var itemToUpdate = context.NoteItemSet.Single(item => item.Id == evnt.NoteId); itemToUpdate.Text = evnt.NewText; context.SaveChanges(); } }
public void Handle(NoteTextChanged evnt) { if (evnt.SummaryId.Equals(Guid.Empty)) { AggregateRoot aggregateRoot = new NoteDailySummary(Guid.NewGuid(), System.DateTime.UtcNow, 0, 1); UnitOfWork.Current.RegisterDirtyInstance(aggregateRoot); } else { var noteDailySummary = UnitOfWork.Current.GetById(typeof(NoteDailySummary), evnt.SummaryId) as NoteDailySummary; noteDailySummary.UpdateDailySummary(0, 1); UnitOfWork.Current.RegisterDirtyInstance(noteDailySummary); } }
public void Handle(NoteTextChanged evnt) { using (var context = new ReadModelContainer()) { var date = evnt.EventTimeStamp.Date; var totalsForDate = context.TotalsPerDayItemSet.SingleOrDefault(i => i.Date == date); if (totalsForDate == null) { totalsForDate = new TotalsPerDayItem { Date = date }; context.TotalsPerDayItemSet.AddObject(totalsForDate); } totalsForDate.EditCount++; context.SaveChanges(); } }
// Event handler for the NoteTextChanged event. This method // is automaticly wired as event handler based on convension. protected void OnNoteTextChanged(NoteTextChanged e) { _text = e.NewText; }
protected virtual void OnNoteTextChanged(NoteEventArgs e) { NoteTextChanged?.Invoke(this, e); }
protected void OnNoteTextChanged(NoteTextChanged e) { this.text = e.Text; }