예제 #1
0
        public void CreateVoter(
            ITransactionVoterNotifyAsync2 voterNotification,
            IntPtr voterBallot)
        {
            if (IntPtr.Zero == voterBallot)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("voterBallot");
            }

            lock (this.syncRoot)
            {
                if (this.currentVoter != null)
                {
                    // transactions require failfasts to prevent corruption
                    DiagnosticUtility.FailFast("Assumption: proxy only needs one voter");
                }

                VoterBallot voter = new VoterBallot(voterNotification, this);
                if (this.currentTransaction != null)
                {
                    voter.SetTransaction(this.currentTransaction);
                }

                this.currentVoter = voter;

                IntPtr ppv = InterfaceHelper.GetInterfacePtrForObject(typeof(ITransactionVoterBallotAsync2).GUID, this.currentVoter);

                Marshal.WriteIntPtr(voterBallot, ppv);
            }
        }
 public void CreateVoter(ITransactionVoterNotifyAsync2 voterNotification, IntPtr voterBallot)
 {
     if (IntPtr.Zero == voterBallot)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("voterBallot");
     }
     lock (this.syncRoot)
     {
         if (this.currentVoter != null)
         {
             DiagnosticUtility.FailFast("Assumption: proxy only needs one voter");
         }
         VoterBallot ballot = new VoterBallot(voterNotification, this);
         if (this.currentTransaction != null)
         {
             ballot.SetTransaction(this.currentTransaction);
         }
         this.currentVoter = ballot;
         IntPtr interfacePtrForObject = InterfaceHelper.GetInterfacePtrForObject(typeof(ITransactionVoterBallotAsync2).GUID, this.currentVoter);
         Marshal.WriteIntPtr(voterBallot, interfacePtrForObject);
     }
 }