Example #1
0
        public override DbManagerProxy Create(ModelUserContext context = null, CacheScope cacheScope = null)
        {
            DbManagerProxy     ret;
            LocalDataStoreSlot slot = Thread.GetNamedDataSlot(DbManagerProxy.NameDbManagerSlot(m_DatabaseType));

            if (slot != null)
            {
                ret = Thread.GetData(slot) as DbManagerProxy;
                if (ret != null)
                {
                    ret.IncrementRef();
                    return(ret);
                }
            }
            else
            {
                slot = Thread.AllocateNamedDataSlot(DbManagerProxy.NameDbManagerSlot(m_DatabaseType));
            }

            var connectionString = (context != null && context.IsArchiveMode)
                ? context.DatabaseConnectionString
                : m_ConnectionString;

            ret = new DbManagerProxy(new SqlDataProvider(), connectionString, context, cacheScope, m_DatabaseType);
            ret.IncrementRef();
            Thread.SetData(slot, ret);
            return(ret);
        }
Example #2
0
 internal DbManagerProxy
     (DataProviderBase provider, string connectionString, ModelUserContext context, CacheScope cacheScope, DatabaseType databaseType)
     : base(provider, connectionString)
 {
     CommandTimeout = 300;
     m_Context      = context;
     m_CacheScope   = cacheScope;
     m_DatabaseType = databaseType;
     if (m_Context != null)
     {
         m_Context.SetContext(this);
     }
 }
Example #3
0
        public override DbManagerProxy Create(ModelUserContext context = null, CacheScope cacheScope = null)
        {
            DbManagerProxy     ret;
            LocalDataStoreSlot slot = Thread.GetNamedDataSlot(DbManagerProxy.NameDbManagerSlot(m_DatabaseType));

            if (slot != null)
            {
                ret = Thread.GetData(slot) as DbManagerProxy;
                if (ret != null)
                {
                    ret.IncrementRef();
                    return(ret);
                }
            }
            else
            {
                slot = Thread.AllocateNamedDataSlot(DbManagerProxy.NameDbManagerSlot(m_DatabaseType));
            }
            ret = new DbManagerProxy(new RemoteSqlDataProvider(), m_url, context, cacheScope, m_DatabaseType);
            ret.IncrementRef();
            Thread.SetData(slot, ret);
            return(ret);
        }
Example #4
0
 public abstract DbManagerProxy Create(ModelUserContext context = null, CacheScope cacheScope = null);