예제 #1
0
 private static void Insert(DbConnection db, ISagaState data, string correlationId)
 {
     try
     {
         db.Insert(new SagaRow()
         {
             SagaId = SagaRow.GetId(correlationId, data.GetType()),
             Data = data.Serialize().ToByteArray(),
             IsCompleted = false,
             LastChangedOn = DateTime.UtcNow,
             Version = data.AutoTimestamp
         });
     }
     catch (DbException ex)
     {
         if (db.IsUniqueViolation(ex)) throw new SagaExistsException();
      
     }
 }