コード例 #1
0
 public Task <AsyncTaskResult> HandleAsync(AddTestifyedEvent 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.GranteeTable, transaction);
         if (effectedRows == 1)
         {
             await connection.InsertAsync(new
             {
                 Id = Guid.NewGuid(),
                 GranteeId = evnt.AggregateRootId,
                 UserId = evnt.Testify.UserId,
                 Name = evnt.Testify.Name,
                 Relationship = evnt.Testify.Relationship,
                 Mobile = evnt.Testify.Mobile,
                 Remark = evnt.Testify.Remark,
                 CreatedOn = evnt.Timestamp
             }, ConfigSettings.GranteeTestifysTable, transaction);
         }
     }));
 }
コード例 #2
0
 private void Handle(AddTestifyedEvent evnt)
 {
     _testifys.Add(evnt.Testify);
 }