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);
 }
示例#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);
 }
示例#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))
 {
 }