public Note(String id, String title) { super(id); applyEvent(new NoteCreated(title)); }
public void changeTitle(String title) { applyEvent(new NoteTitleChanged(title)); }
protected void handle(NoteCreated evnt) { _title = evnt.getTitle(); }
protected void handle(NoteTitleChanged evnt) { _title = evnt.getTitle(); }
public void handle(ICommandContext context, CreateNoteCommand command) { context.add(new Note(command.getAggregateRootId(), command.getTitle())); } }
public void handle(ICommandContext context, ChangeNoteTitleCommand command) { context.get(Note.class, command.getAggregateRootId()).changeTitle(command.getTitle()); } }