[该贴被banq于2013-07-29 15:02修改过]
http://simon-says-architecture.com/2013/03/07/modelling-accounting-ledger-event-driven/
http://simon-says-architecture.com/2013/03/22/modelling-accounting-ledger-event-driven-2/更正一下,我前面提到一个命令一个事件,是指一个命令对应上游事件,一旦上游事件进入聚合根内部,变成很多事件流分支,比如
var tx = new Transaction(); tx.Post(amount, fromAccount, toAccount); transactionRepository.Store(tx); <p class="indent">
public void Post(decimal amount, string fromAccount, string toAccount) { this.Apply(new AccountDebited(amount, fromAccount)); this.Apply(new AccountCredited(amount, toAccount)); } <p class="indent">
[该贴被banq于2013-07-30 17:08修改过]