コード例 #1
0
        /// <summary>
        /// 处理 更新快递地址
        /// </summary>
        /// <param name="evnt"></param>
        /// <returns></returns>
        public Task <AsyncTaskResult> HandleAsync(ExpressAddressUpdatedEvent 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.UpdateAsync(new
                    {
                        Name = evnt.Info.Name,
                        Region = evnt.Info.Region,
                        Address = evnt.Info.Address,
                        Zip = evnt.Info.Zip
                    }, new
                    {
                        UserId = evnt.AggregateRootId,
                        Id = evnt.ExpressAddressId
                    }, ConfigSettings.ExpressAddressTable, transaction);
                }
            }));
        }
コード例 #2
0
ファイル: User.cs プロジェクト: zanderphh/Shop
 private void Handle(ExpressAddressUpdatedEvent evnt)
 {
     _expressAddresses.Single(x => x.Id == evnt.ExpressAddressId).Info = evnt.Info;
 }