コード例 #1
0
		private void InnerBegin()
		{
			Contract.Ensures(_State == TransactionState.Active);
			// we have a ongoing current transaction, join it!
			if (System.Transactions.Transaction.Current != null)
			{
				var ktx = (IKernelTransaction) TransactionInterop.GetDtcTransaction(System.Transactions.Transaction.Current);

				SafeKernelTransactionHandle handle;
				ktx.GetHandle(out handle);

				// even though _TransactionHandle can already contain a handle if this thread 
				// had been yielded just before setting this reference, the "safe"-ness of the wrapper should
				// not dispose the other handle which is now removed
				_TransactionHandle = handle;
				//IsAmbient = true; // TODO: Perhaps we created this item and we need to notify the transaction manager...
			}
			else _TransactionHandle = NativeMethods.createTransaction(string.Format("{0} Transaction", _Name));

			if (!_TransactionHandle.IsInvalid)
			{
				_State = TransactionState.Active;
				return;
			}

			throw new TransactionException(
				"Cannot begin file transaction. CreateTransaction failed and there's no ambient transaction.",
				LastEx());
		}
コード例 #2
0
ファイル: NativeMethods.cs プロジェクト: bittercoder/Windsor
		internal static extern bool RemoveDirectoryTransactedW(
			[MarshalAs(UnmanagedType.LPWStr)] string lpPathName,
			SafeKernelTransactionHandle hTransaction);
コード例 #3
0
ファイル: NativeMethods.cs プロジェクト: bittercoder/Windsor
		internal static extern bool CommitTransaction(SafeKernelTransactionHandle transaction);
コード例 #4
0
ファイル: NativeMethods.cs プロジェクト: bittercoder/Windsor
		internal static extern bool CreateDirectoryTransactedW(
			[MarshalAs(UnmanagedType.LPWStr)] string lpTemplateDirectory,
			[MarshalAs(UnmanagedType.LPWStr)] string lpNewDirectory,
			IntPtr lpSecurityAttributes,
			SafeKernelTransactionHandle hTransaction);
コード例 #5
0
ファイル: NativeMethods.cs プロジェクト: bittercoder/Windsor
		/// <summary>
		/// Not extern
		/// </summary>
		internal static SafeFindHandle FindFirstFileTransactedW(string lpFileName,
			SafeKernelTransactionHandle kernelTxHandle, out WIN32_FIND_DATA lpFindFileData)
		{
			return FindFirstFileTransactedW(lpFileName, FINDEX_INFO_LEVELS.FindExInfoStandard,
											out lpFindFileData,
											FINDEX_SEARCH_OPS.FindExSearchNameMatch,
											IntPtr.Zero, 0,
											kernelTxHandle);
		}
コード例 #6
0
ファイル: NativeMethods.cs プロジェクト: bittercoder/Windsor
		/// <summary>
		/// Not extern
		/// </summary>
		internal static SafeFindHandle FindFirstFileTransacted(string filePath, bool directory, SafeKernelTransactionHandle kernelTxHandle)
		{
			WIN32_FIND_DATA data;

#if MONO
			const uint caseSensitive = 0x1;
#else
			const uint caseSensitive = 0;
#endif

			return FindFirstFileTransactedW(filePath,
											FINDEX_INFO_LEVELS.FindExInfoStandard, out data,
											directory
												? FINDEX_SEARCH_OPS.FindExSearchLimitToDirectories
												: FINDEX_SEARCH_OPS.FindExSearchNameMatch,
											IntPtr.Zero, caseSensitive, kernelTxHandle);
		}
コード例 #7
0
ファイル: NativeMethods.cs プロジェクト: bittercoder/Windsor
		internal static extern bool DeleteFileTransactedW(
			[MarshalAs(UnmanagedType.LPWStr)] string file,
			SafeKernelTransactionHandle transaction);
コード例 #8
0
ファイル: NativeMethods.cs プロジェクト: bittercoder/Windsor
		internal static extern bool RollbackTransaction(SafeKernelTransactionHandle transaction);