public void AddParticipant(IUnitOfWorkParticipant participant)
 {
     _usageGuard.AssertNoContextChangeOccurred(this);
     Log.DebugFormat("Adding participant {0} {1}", participant.GetType(), participant.Id);
     if(participant.UnitOfWork != null && participant.UnitOfWork != this)
     {
         throw new AttemptingToJoinSecondUnitOfWorkException(participant, this);
     }
     participant.Join(this);
     _participants.Add(participant);
 }
Beispiel #2
0
 public void AddParticipant(IUnitOfWorkParticipant participant)
 {
     _usageGuard.AssertNoContextChangeOccurred(this);
     Log.DebugFormat("Adding participant {0} {1}", participant.GetType(), participant.Id);
     if (participant.UnitOfWork != null && participant.UnitOfWork != this)
     {
         throw new AttemptingToJoinSecondUnitOfWorkException(participant, this);
     }
     participant.Join(this);
     _participants.Add(participant);
 }
Beispiel #3
0
 public AttemptingToJoinSecondUnitOfWorkException(IUnitOfWorkParticipant participant, UnitsOfWork.UnitOfWork unitOfWork)
     : base(String.Format("{0} with Id: {1} tried to join Unit: {2} while participating in unit {3}",
                          participant.GetType(), participant.Id, unitOfWork.Id, participant.UnitOfWork))
 {
 }