public Task <AsyncTaskResult> HandleAsync(RegionPartnerApplyedEvent evnt) { return(TryTransactionAsync(async(connection, transaction) => { //尽管是更新ExpressAddresssTable但是也要更新聚合跟,因为地址属于聚合跟的状态 var effectedRows = await connection.UpdateAsync(new { Version = evnt.Version, EventSequence = evnt.Sequence }, new { Id = evnt.AggregateRootId, //Version = evnt.Version - 1 }, ConfigSettings.UserTable, transaction); if (effectedRows == 1) { await connection.InsertAsync(new { UserId = evnt.AggregateRootId, Region = evnt.Region, Level = (int)evnt.Level, CreatedOn = evnt.Timestamp, }, ConfigSettings.PartnerApplyTable, transaction); } })); }
private void Handle(RegionPartnerApplyedEvent evnt) { }