GetFactory() public static méthode

public static GetFactory ( string providerInvariantName ) : System.Data.Common.DbProviderFactory
providerInvariantName string
Résultat System.Data.Common.DbProviderFactory
Exemple #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);
        }