コード例 #1
0
        private static DbProviderFactory GetDbProviderFactory(string providerName)
        {
            DbProviderFactory dbProviderFactory;

            if (!string.IsNullOrEmpty(providerName))
            {
                //
                // If the user has supplied a provider name, that's the one
                // we must use.
                //

                dbProviderFactory = DbProviderFactoryQuery.GetFactory(providerName);
            }
            else
            {
                //
                // Otherwise, we try to use ODP.Net in the first instance
                // and then fallback to the Microsoft client.
                //

                dbProviderFactory = DbProviderFactoryQuery.FindFactory("Oracle.DataAccess.Client")
                                    ?? DbProviderFactoryQuery.GetFactory("System.Data.OracleClient");
            }

            return(dbProviderFactory);
        }
コード例 #2
0
        private static DbProviderFactory GetDbProviderFactory(string providerName)
        {
            DbProviderFactory dbProviderFactory;

            if (!string.IsNullOrEmpty(providerName))
            {
                //
                // If the user has supplied a provider name, that's the one
                // we must use.
                //

                dbProviderFactory = DbProviderFactoryQuery.GetFactory(providerName);
            }
            else
            {
                //
                // Otherwise, we fallback to the Microsoft client.
                //

                dbProviderFactory = DbProviderFactoryQuery.GetFactory("System.Data.OracleClient");
            }

            return(dbProviderFactory);
        }