public void FillFromUsage(IConnectionUsage usage) { if (usage.Connection != null) { Connection = usage.Connection.PhysicalFactory; } }
public bool IsOpened(IPhysicalConnectionFactory fact) { string key = fact.GetConnectionKey(); lock (m_connCache) { var item = m_connCache[key]; return(item.Connection != null && item.Connection.IsOpened); } }
public void AssignServerFields(ServerFieldsAppObject appobj) { if (appobj == null) { Connection = null; } else { Connection = appobj.Connection; } }
public void Close(IPhysicalConnectionFactory fact) { string key = fact.GetConnectionKey(); lock (m_connCache) { if (!m_connCache.ContainsKey(key)) { throw new InternalError("DAE-00029 Connection key not found"); } m_connCache[key].RefCount--; if (m_connCache[key].RefCount <= 0 && !m_connCache[key].KeepAlive) { Async.SafeClose(m_connCache[key].Connection); } } }
private IPhysicalConnection _OpenCore(IPhysicalConnectionFactory fact, bool keepAlive, bool incref, bool open) { if (fact == null) { return(null); } string key = fact.GetConnectionKey(); IPhysicalConnection res; lock (m_connCache) { if (!m_connCache.ContainsKey(key)) { var item = new CacheItem(); item.Connection = fact.CreateConnection(); if (Cache != null) { // use shared cache item.Connection.Cache = Cache.Connection(key); } item.Connection.Owner = this; m_connCache[key] = item; } if (incref) { m_connCache[key].RefCount++; } if (keepAlive) { m_connCache[key].KeepAlive = true; } res = m_connCache[key].Connection; } if (open) { Async.SafeOpen(res); } return(res); }
public DbDefReadonlyTreeNode(ITreeNode parent, IPhysicalConnectionFactory fact, string name) : base(new DbDefSource(fact, DbDefSource.ReadOnly.Flag), parent, name, false) { }
public IPhysicalConnection GetConnection(IPhysicalConnectionFactory fact, bool keepAlive) { return(_OpenCore(fact, keepAlive, false, false)); }
public IPhysicalConnection Open(IPhysicalConnectionFactory fact, bool keepAlive) { return(_OpenCore(fact, keepAlive, true, true)); }
protected NoThreadPhysicalConnectionBase(IPhysicalConnectionFactory factory) { PhysicalFactory = factory; Cache = new ConnectionCache(); }
protected PhysicalConnectionBase(IPhysicalConnectionFactory factory) { Cache = new ConnectionCache(); PhysicalFactory = factory; ConnectionRegister.AddConnection(this); }
public DbDefConnection(IPhysicalConnectionFactory factory) : base(factory) { }
// constructor 3' public DbDefSource(IPhysicalConnectionFactory fact, ReadOnly flag) { m_conn = (DbDefConnection)fact.CreateConnection(); m_openedReadOnly = true; }