public static void ReadUncommitted() { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.Transaction = TransactionOption.NotSupported; serviceConfig.IsolationLevel = TransactionIsolationLevel.ReadUncommitted; ServiceDomain.Enter(serviceConfig); }
public static void Serializable() { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.Transaction = TransactionOption.Required; serviceConfig.IsolationLevel = TransactionIsolationLevel.Serializable; ServiceDomain.Enter(serviceConfig); }
public static void RepeatableRead() { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.Transaction = TransactionOption.Required; serviceConfig.IsolationLevel = TransactionIsolationLevel.RepeatableRead; ServiceDomain.Enter(serviceConfig); }
// Enter a new service configuration. public static void Enter(ServiceConfig cfg) { if(configList == null) { configList = new ArrayList(); } configList.Add(cfg); }
public static void TransactionStart() { // Enter a new transaction without inheriting from ServicedComponent Console.WriteLine("Attempting to enter a transactional context..."); ServiceConfig config = new ServiceConfig(); config.Transaction = TransactionOption.RequiresNew; ServiceDomain.Enter(config); Console.WriteLine("Attempt suceeded!"); }
private void EnterTxContext(TransactionOption txOption) { ServiceConfig config = new ServiceConfig(); config.Transaction = txOption; ServiceDomain.Enter(config); // Since Enter can throw, the next statement will track the success // In the case of success will we need to call Leave in Dispose this.EnterSucceeded = true; }
private ServiceConfig CreateServicedConfig() { ServiceConfig config = new ServiceConfig(); config.TrackingEnabled = true; config.TrackingAppName = "Nunit Transaction Test Case"; config.TrackingComponentName = this.Invoker.Name; config.Transaction = TransactionOption.Required; return config; }
public ServiceConfig CreateServiceConfig() { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.TransactionDescription = this.transactionDescription; serviceConfig.TrackingEnabled = this.trackingEnabled; serviceConfig.TrackingAppName = this.trackingAppName; serviceConfig.TrackingComponentName = this.trackingComponentName; serviceConfig.Transaction = this.transactionOption; serviceConfig.IsolationLevel = this.isolationLevel; serviceConfig.TransactionTimeout = this.transactionTimeout; return serviceConfig; }
private ServiceConfig CreateServiceConfig(TransactionContext trCtx) { ServiceConfig config = new ServiceConfig(); TransactionOption transactionOption = (TransactionOption)Enum.Parse(typeof(TransactionOption), trCtx.Affinity.ToString()); config.Transaction = transactionOption; System.EnterpriseServices.TransactionIsolationLevel isolationLevel = (System.EnterpriseServices.TransactionIsolationLevel)Enum.Parse(typeof(System.EnterpriseServices.TransactionIsolationLevel), trCtx.IsolationLevel.ToString()); config.IsolationLevel = isolationLevel; return config; }
// The demand is not added now (in 4.5), to avoid a breaking change. To be considered in the next version. /* [PermissionSet(SecurityAction.Demand, Unrestricted = true)] // because we call code from a non-APTCA assembly; transactions are not supported in partial trust, so customers should not be broken by this demand */ public static Transaction GetMessageTransaction(Message message) { ServiceConfig serviceConfig = new ServiceConfig(); serviceConfig.Transaction = TransactionOption.Disabled; ServiceDomain.Enter( serviceConfig ); try { return TransactionMessageProperty.TryGetTransaction(message); } finally { ServiceDomain.Leave(); } }
public static Transaction GetMessageTransaction(Message message) { Transaction transaction; ServiceConfig cfg = new ServiceConfig { Transaction = TransactionOption.Disabled }; ServiceDomain.Enter(cfg); try { transaction = TransactionMessageProperty.TryGetTransaction(message); } finally { ServiceDomain.Leave(); } return transaction; }
public Transaction() { _disposed = false; ServiceConfig config = new ServiceConfig(); config.Transaction = TransactionOption.Required; ServiceDomain.Enter(config); // SetComplete must be explicitely called. ContextUtil.MyTransactionVote = TransactionVote.Abort; // Check if connection is already open if (Session.Current.IsConnected) { IDbConnection con = Session.Current.Connection; if (con.State == ConnectionState.Open) { ((SqlConnection)con).EnlistDistributedTransaction((ITransaction)ContextUtil.Transaction); } } }
protected override void OnPreProcess(object sender,PreProcessEventArgs args) { try { ServiceConfig config = new ServiceConfig(); config.Transaction=TransactionOption.RequiresNew; config.TrackingAppName="Application Unit Tests"; config.TransactionDescription="Application Unit Tests Transaction"; config.TransactionTimeout=10000; OutputDebugMessage("ENTERING transaction context on method: " + args.MethodCallMessage.MethodBase.Name); ServiceDomain.Enter(config); OutputDebugMessage("ENTRED transaction context on method: " + args.MethodCallMessage.MethodBase.Name); } catch(Exception e) { OutputDebugMessage("Could not enter into a new transaction:\n" + e.ToString()); } }
/// <include file='doc\SWC.uex' path='docs/doc[@for="ServiceDomain.Enter"]/*' /> public static void Enter(ServiceConfig cfg) { Platform.Assert(Platform.Supports(PlatformFeature.SWC), "ServiceDomain"); Thunk.ServiceDomainThunk.EnterServiceDomain(cfg.SCT); }
// Constructor. public Activity(ServiceConfig cfg) {}
public Activity(ServiceConfig cfg) { throw new NotImplementedException(); }
public static void Enter(ServiceConfig cfg) { ServiceDomainThunk.EnterServiceDomain(cfg.SCT); }
private ServiceConfig CreateServicedConfig() { ServiceConfig config = new ServiceConfig(); config.TrackingEnabled = true; config.TrackingAppName = "MbUnit Transaction Test Case"; config.TrackingComponentName = this.Invoker.Name; config.Transaction = TransactionOption.Required; if (TimeOutValue != 0) { config.TransactionTimeout = TimeOutValue; } return config; }
private void PushServiceDomain( Transaction newCurrent ) { // If we are not changing the transaction for the current ServiceDomain then // don't call CoEnterServiceDomain if ((newCurrent != null && newCurrent.Equals( SysES.ContextUtil.SystemTransaction )) || (newCurrent == null && SysES.ContextUtil.SystemTransaction == null )) { return; } SysES.ServiceConfig serviceConfig = new SysES.ServiceConfig(); try { // If a transaction is specified place it in BYOT. Otherwise the // default transaction option for ServiceConfig is disabled. So // if this is a not supported scope it will be cleared. if ( newCurrent != null ) { // To work around an SWC bug in Com+ we need to create 2 // service domains. // Com+ will by default try to inherit synchronization from // an existing context. Turn that off. serviceConfig.Synchronization = SysES.SynchronizationOption.RequiresNew; SysES.ServiceDomain.Enter( serviceConfig ); this.createdDoubleServiceDomain = true; serviceConfig.Synchronization = SysES.SynchronizationOption.Required; serviceConfig.BringYourOwnSystemTransaction = newCurrent; } SysES.ServiceDomain.Enter( serviceConfig ); this.createdServiceDomain = true; } catch ( COMException e ) { if ( System.Transactions.Oletx.NativeMethods.XACT_E_NOTRANSACTION == e.ErrorCode ) { throw TransactionException.Create(SR.GetString(SR.TraceSourceBase), SR.GetString(SR.TransactionAlreadyOver), e, newCurrent == null ? Guid.Empty : newCurrent.DistributedTxId); } throw TransactionException.Create(SR.GetString(SR.TraceSourceBase), e.Message, e, newCurrent == null ? Guid.Empty : newCurrent.DistributedTxId); } finally { if ( !this.createdServiceDomain ) { // If we weren't successful in creating both service domains then // make sure to exit one of them. if ( this.createdDoubleServiceDomain ) { SysES.ServiceDomain.Leave(); } } } }
public static void Enter(ServiceConfig cfg) { throw new NotImplementedException(); }
/// <include file='doc\SWC.uex' path='docs/doc[@for="Activity.Activity"]/*' /> public Activity(ServiceConfig cfg) { Platform.Assert(Platform.Supports(PlatformFeature.SWC), "Activity"); m_sat = new Thunk.ServiceActivityThunk(cfg.SCT); }
// Constructor. public Activity(ServiceConfig cfg) { }
private void PushServiceDomain(Transaction newCurrent) { if (((newCurrent == null) || !newCurrent.Equals(ContextUtil.SystemTransaction)) && ((newCurrent != null) || (ContextUtil.SystemTransaction != null))) { ServiceConfig cfg = new ServiceConfig(); try { if (newCurrent != null) { cfg.Synchronization = SynchronizationOption.RequiresNew; ServiceDomain.Enter(cfg); this.createdDoubleServiceDomain = true; cfg.Synchronization = SynchronizationOption.Required; cfg.BringYourOwnSystemTransaction = newCurrent; } ServiceDomain.Enter(cfg); this.createdServiceDomain = true; } catch (COMException exception) { if (System.Transactions.Oletx.NativeMethods.XACT_E_NOTRANSACTION == exception.ErrorCode) { throw TransactionException.Create(System.Transactions.SR.GetString("TraceSourceBase"), System.Transactions.SR.GetString("TransactionAlreadyOver"), exception); } throw TransactionException.Create(System.Transactions.SR.GetString("TraceSourceBase"), exception.Message, exception); } finally { if (!this.createdServiceDomain && this.createdDoubleServiceDomain) { ServiceDomain.Leave(); } } } }
/// <summary> Start a new database transaction.</summary> public static void BeginTransaction() { log.Debug("Starting new COM+ transaction."); ServiceConfig sc = new ServiceConfig(); sc.Transaction = TransactionOption.RequiresNew; ServiceDomain.Enter(sc); }
public Activity (ServiceConfig cfg) { throw new NotImplementedException (); }
/// <summary> /// /// </summary> private void EnterTransactionContext() { if (++TransactionScopeCount == 1) { if (_logger.IsDebugEnabled) { _logger.Debug("Create a new ServiceConfig in ServiceDomain."); } ServiceConfig config = new ServiceConfig(); config.TrackingEnabled = true; config.TrackingAppName = "iBATIS.NET"; config.TrackingComponentName = "TransactionScope"; config.TransactionDescription = "iBATIS.NET Distributed Transaction"; config.Transaction = TransactionScopeOptions2TransactionOption( _txScopeOptions ); config.TransactionTimeout = _txOptions.TimeOut.Seconds; config.IsolationLevel = IsolationLevel2TransactionIsolationLevel( _txOptions.IsolationLevel ); // every call to ServiceDomain.Enter() creates a new COM+ Context //(verified by calls to ContextUtil.ContextId), // and every call to ServiceDomain.Leave() terminates that context ServiceDomain.Enter(config); } _closed = false; if (_logger.IsDebugEnabled) { _logger.Debug("Open TransactionScope :"+ContextUtil.ContextId); } }
public static void Enter (ServiceConfig cfg) { throw new NotImplementedException (); }
public Activity(ServiceConfig cfg) { this.m_sat = new ServiceActivityThunk(cfg.SCT); }