protected internal virtual DataTable GetSchema(DbConnectionFactory factory, DbConnectionPoolGroup poolGroup, DbConnection outerConnection, string collectionName, string[] restrictions)
        {
            Debug.Assert(outerConnection != null, "outerConnection may not be null.");

            DbMetaDataFactory metaDataFactory = factory.GetMetaDataFactory(poolGroup, this);

            Debug.Assert(metaDataFactory != null, "metaDataFactory may not be null.");

            return(metaDataFactory.GetSchema(outerConnection, collectionName, restrictions));
        }
        internal DbMetaDataFactory GetMetaDataFactory(DbConnectionPoolGroup connectionPoolGroup, DbConnectionInternal internalConnection)
        {
            DbMetaDataFactory metaDataFactory = connectionPoolGroup.MetaDataFactory;

            if (metaDataFactory == null)
            {
                bool cacheMetaDataFactory = false;
                metaDataFactory = this.CreateMetaDataFactory(internalConnection, out cacheMetaDataFactory);
                if (cacheMetaDataFactory)
                {
                    connectionPoolGroup.MetaDataFactory = metaDataFactory;
                }
            }
            return(metaDataFactory);
        }
예제 #3
0
        internal DbMetaDataFactory GetMetaDataFactory(DbConnectionPoolGroup connectionPoolGroup, DbConnectionInternal internalConnection)
        {
            Debug.Assert(connectionPoolGroup != null, "connectionPoolGroup may not be null.");

            // get the matadatafactory from the pool entry. If it does not already have one
            // create one and save it on the pool entry
            DbMetaDataFactory metaDataFactory = connectionPoolGroup.MetaDataFactory;

            // consider serializing this so we don't construct multiple metadata factories
            // if two threads happen to hit this at the same time.  One will be GC'd
            if (metaDataFactory == null)
            {
                bool allowCache = false;
                metaDataFactory = CreateMetaDataFactory(internalConnection, out allowCache);
                if (allowCache)
                {
                    connectionPoolGroup.MetaDataFactory = metaDataFactory;
                }
            }
            return(metaDataFactory);
        }