/// <summary> /// 预提交 /// </summary> /// <param name="transactionPreparation">事务准备</param> public void PreCommit(ITransactionPreparation transactionPreparation) { if (transactionPreparation == null) { throw new ArgumentNullException(nameof(transactionPreparation)); } if (SupportedTransactionParticipantTypes == null || !SupportedTransactionParticipantTypes.Contains(transactionPreparation.GetType())) { throw new ApplicationException($"Unknown transaction preparation {transactionPreparation.GetType().Name} for aggregate root {this.GetType().Name}, id={Id}."); } InternalPreCommit(transactionPreparation); }
/// <summary> /// 预提交 /// </summary> /// <param name="transactionPreparation">事务准备</param> public void PreCommit(ITransactionPreparation transactionPreparation) { if (transactionPreparation == null) { throw new ArgumentNullException(nameof(transactionPreparation)); } if (SupportedTransactionParticipantTypes == null || !SupportedTransactionParticipantTypes.Contains(transactionPreparation.GetType())) { throw new ApplicationException($"Unknown transaction preparation {transactionPreparation.GetType().Name} for aggregate root {this.GetType().Name}, id={Id}."); } if (PreventPreCommitOrNotIfTransactionProcessing && IsTransactionProcessing) { throw new AlreadyStartTransactionWhenPreCommitDomainException <TTransactionInitiator, TAggregateRootId>(transactionPreparation.GetType().FullName, transactionPreparation.GetTransactionPreparationInfo()); } InternalPreCommit(transactionPreparation); }