예제 #1
0
 /// <summary>
 /// 处理 删除更新地址
 /// </summary>
 /// <param name="evnt"></param>
 /// <returns></returns>
 public Task <AsyncTaskResult> HandleAsync(ExpressAddressRemovedEvent evnt)
 {
     return(TryTransactionAsync(async(connection, transaction) =>
     {
         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.DeleteAsync(new
             {
                 UserId = evnt.AggregateRootId,
                 Id = evnt.ExpressAddressId
             }, ConfigSettings.ExpressAddressTable, transaction);
         }
     }));
 }
예제 #2
0
파일: User.cs 프로젝트: zanderphh/Shop
 private void Handle(ExpressAddressRemovedEvent evnt)
 {
     _expressAddresses.Remove(_expressAddresses.Single(x => x.Id == evnt.ExpressAddressId));
 }