Esempio n. 1
0
        /// <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));
        }
Esempio n. 2
0
 /// <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));
 }