private static INpgsqlResourceManager CreateResourceManager() { // TODO: create network proxy for resource manager if (_resourceManager == null) { AppDomain rmDomain = AppDomain.CreateDomain("NpgsqlResourceManager", AppDomain.CurrentDomain.Evidence, AppDomain.CurrentDomain.SetupInformation); _resourceManager = (INpgsqlResourceManager) rmDomain.CreateInstanceAndUnwrap(typeof(NpgsqlResourceManager).Assembly.FullName, typeof(NpgsqlResourceManager).FullName); } return(_resourceManager); //return new NpgsqlResourceManager(); }
private static INpgsqlResourceManager CreateResourceManager() { // TODO: create network proxy for resource manager if (_resourceManager == null) { _sponser = new System.Runtime.Remoting.Lifetime.ClientSponsor(); AppDomain rmDomain = AppDomain.CreateDomain("NpgsqlResourceManager", AppDomain.CurrentDomain.Evidence, AppDomain.CurrentDomain.SetupInformation); _resourceManager = (INpgsqlResourceManager) rmDomain.CreateInstanceAndUnwrap(typeof(NpgsqlResourceManager).Assembly.FullName, typeof(NpgsqlResourceManager).FullName); _sponser.Register((MarshalByRefObject)_resourceManager); } return(_resourceManager); }
private static INpgsqlResourceManager CreateResourceManager() { // TODO: create network proxy for resource manager if (_resourceManager == null) { #if NETSTANDARD2_0 throw new NotSupportedException("Not supported on .NET core"); #else _sponser = new System.Runtime.Remoting.Lifetime.ClientSponsor(); AppDomain rmDomain = AppDomain.CreateDomain("NpgsqlResourceManager", AppDomain.CurrentDomain.Evidence, AppDomain.CurrentDomain.SetupInformation); _resourceManager = (INpgsqlResourceManager) rmDomain.CreateInstanceAndUnwrap(typeof(NpgsqlResourceManager).Assembly.FullName, typeof(NpgsqlResourceManager).FullName); _sponser.Register((MarshalByRefObject)_resourceManager); #endif } return(_resourceManager); }
public byte[] Promote() { _rm = CreateResourceManager(); // may not be null if Prepare or Enlist is called first if (_callbacks == null) { _callbacks = new NpgsqlTransactionCallbacks(_connection); } byte[] token = _rm.Promote(_callbacks); // mostly likely case for this is the transaction has been prepared. if (_npgsqlTx != null) { // cancel the NpgsqlTransaction since this will // be handled by a two phase commit. _npgsqlTx.Cancel(); _npgsqlTx.Dispose(); _npgsqlTx = null; } return(token); }
public void Enlist(Transaction tx) { if (tx != null) { _isolationLevel = tx.IsolationLevel; if (!tx.EnlistPromotableSinglePhase(this)) { // must already have a durable resource // start transaction _npgsqlTx = _connection.BeginTransaction(ConvertIsolationLevel(_isolationLevel)); _inTransaction = true; _rm = CreateResourceManager(); _callbacks = new NpgsqlTransactionCallbacks(_connection); _rm.Enlist(_callbacks, TransactionInterop.GetTransmitterPropagationToken(tx)); // enlisted in distributed transaction // disconnect and cleanup local transaction _npgsqlTx.Cancel(); _npgsqlTx.Dispose(); _npgsqlTx = null; } } }
public byte[] Promote() { NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Promote"); _rm = CreateResourceManager(); // may not be null if Prepare or Enlist is called first if (_callbacks == null) { _callbacks = new NpgsqlTransactionCallbacks(_connection); } byte[] token = _rm.Promote(_callbacks); // mostly likely case for this is the transaction has been prepared. if (_npgsqlTx != null) { // cancel the NpgsqlTransaction since this will // be handled by a two phase commit. _npgsqlTx.Cancel(); _npgsqlTx.Dispose(); _npgsqlTx = null; _connection.PromotableLocalTransactionEnded(); } return(token); }
public void Enlist(Transaction tx) { if (tx != null) { _isolationLevel = tx.IsolationLevel; if (!tx.EnlistPromotableSinglePhase(this)) { // must already have a durable resource // start transaction _npgsqlTx = _connection.BeginTransaction(ConvertIsolationLevel(_isolationLevel)); _inTransaction = true; _rm = CreateResourceManager(); _callbacks = new NpgsqlTransactionCallbacks(_connection); _rm.Enlist(_callbacks, TransactionInterop.GetTransmitterPropagationToken(tx)); // enlisted in distributed transaction // disconnect and cleanup local transaction _npgsqlTx.Cancel(); _npgsqlTx.Dispose(); _npgsqlTx = null; } } }
private static INpgsqlResourceManager CreateResourceManager() { // TODO: create network proxy for resource manager if (_resourceManager == null) { _sponser = new System.Runtime.Remoting.Lifetime.ClientSponsor(); AppDomain rmDomain = AppDomain.CreateDomain("NpgsqlResourceManager", AppDomain.CurrentDomain.Evidence, AppDomain.CurrentDomain.SetupInformation); _resourceManager = (INpgsqlResourceManager) rmDomain.CreateInstanceAndUnwrap(typeof (NpgsqlResourceManager).Assembly.FullName, typeof (NpgsqlResourceManager).FullName); _sponser.Register((MarshalByRefObject)_resourceManager); } return _resourceManager; //return new NpgsqlResourceManager(); }
public byte[] Promote() { NpgsqlEventLog.LogMethodEnter(LogLevel.Debug, CLASSNAME, "Promote"); _rm = CreateResourceManager(); // may not be null if Prepare or Enlist is called first if (_callbacks == null) { _callbacks = new NpgsqlTransactionCallbacks(_connection); } byte[] token = _rm.Promote(_callbacks); // mostly likely case for this is the transaction has been prepared. if (_npgsqlTx != null) { // cancel the NpgsqlTransaction since this will // be handled by a two phase commit. _npgsqlTx.Cancel(); _npgsqlTx.Dispose(); _npgsqlTx = null; _connection.PromotableLocalTransactionEnded(); } return token; }
private static INpgsqlResourceManager CreateResourceManager() { // TODO: create network proxy for resource manager if (_resourceManager == null) { AppDomain rmDomain = AppDomain.CreateDomain("NpgsqlResourceManager", AppDomain.CurrentDomain.Evidence, AppDomain.CurrentDomain.SetupInformation); _resourceManager = (INpgsqlResourceManager) rmDomain.CreateInstanceAndUnwrap(typeof (NpgsqlResourceManager).Assembly.FullName, typeof (NpgsqlResourceManager).FullName); } return _resourceManager; //return new NpgsqlResourceManager(); }
public byte[] Promote() { _rm = CreateResourceManager(); // may not be null if Prepare or Enlist is called first if (_callbacks == null) { _callbacks = new NpgsqlTransactionCallbacks(_connection); } byte[] token = _rm.Promote(_callbacks); // mostly likely case for this is the transaction has been prepared. if (_npgsqlTx != null) { // cancel the NpgsqlTransaction since this will // be handled by a two phase commit. _npgsqlTx.Cancel(); _npgsqlTx.Dispose(); _npgsqlTx = null; } return token; }