/// <summary> /// Create transaction scope wrapping existing storage transaction. /// </summary> /// <param name="transactionToUse"> /// Transaction to wrap; may be null. /// </param> /// <param name="dispose"> /// Dispose underlying storage transaction at the end of the scope. /// </param> /// <returns> /// New scope. /// </returns> public IStorageTransactionScope CreateTransactionScope(IFileSystemTransaction transactionToUse, bool dispose) { CheckTransactionsSupported(); Check.DoAssertLambda(transactionToUse == null || transactionToUse is KtmTransaction, () => new ArgumentException("Unknown transaction type")); Check.DoAssertLambda(transactionToUse == null || transactionToUse.IsActive, () => new ArgumentException("The transaction is not active")); _log.Debug("Creating storage transaction scope from provided transaction"); return(KtmTransactionScope.Create((KtmTransaction)transactionToUse, dispose)); }
/// <summary> /// Creates new scope, starts new independent storage transaction regardless of current storage and managed context. /// </summary> /// <param name="dispose"> /// Dispose underlying storage transaction at the end of the scope. /// </param> /// <returns> /// New scope. /// </returns> /// <remarks> /// </remarks> public IStorageTransactionScope CreateStandaloneTransactionScope(bool dispose) { return(KtmTransactionScope.CreateLocal(dispose)); }
/// <summary> /// Create transaction scope for storage IO. /// </summary> /// <param name="masterTransaction"> /// Transaction to be made master of the underlying storage transaction. /// </param> /// <param name="dispose"> /// Dispose underlying storage transaction at the end of the scope. /// </param> /// <returns> /// New scope. /// </returns> /// <remarks> /// Creates new storage transaction participating in the specified managed <paramref name="masterTransaction"/> /// regardless of current storage and managed context. The underlying storage transaction will be subscribed to master transaction's completion event /// if <paramref name="dispose"/> is <see langword="false"/>. /// </remarks> public IStorageTransactionScope CreateSlaveTransactionScope(Transaction masterTransaction, bool dispose) { return(KtmTransactionScope.Create(masterTransaction, dispose)); }
/// <summary> /// Create transaction scope for storage IO. /// </summary> /// <param name="dispose"> /// Dispose underlying storage transaction at the end of the scope. /// </param> /// <returns> /// New scope. /// </returns> /// <remarks> /// Creates new storage transaction participating in the ambient managed transaction (<see cref="System.Transactions.Transaction.Current"/>) /// regardless of current storage and managed context. /// </remarks> public IStorageTransactionScope CreateSlaveTransactionScope(bool dispose) { return(KtmTransactionScope.CreateJoinAmbientManaged(dispose)); }