public static string GetProviderInvariantName(this DbProviderFactory factory) { DebugCheck.NotNull(factory); const int invariantNameIndex = 2; #if NETSTANDARD var dataRows = DbProviderFactoriesCore.GetFactoryClasses().Rows.OfType <DataRow>(); var row = new ProviderRowFinder().FindRow( factory.GetType(), r => DbProviderFactoriesCore.GetFactory(r).GetType() == factory.GetType(), dataRows); #else var dataRows = DbProviderFactories.GetFactoryClasses().Rows.OfType <DataRow>(); var row = new ProviderRowFinder().FindRow( factory.GetType(), r => DbProviderFactories.GetFactory(r).GetType() == factory.GetType(), dataRows); #endif if (row == null) { throw new NotSupportedException(Strings.ProviderNameNotFound(factory)); } return((string)row[invariantNameIndex]); }
public Net40DefaultDbProviderFactoryService( ProviderRowFinder finder) { DebugCheck.NotNull(finder); _finder = finder; }
public static string GetProviderInvariantName(this DbProviderFactory factory) { DebugCheck.NotNull(factory); const int invariantNameIndex = 2; var dataRows = DbProviderFactories.GetFactoryClasses().Rows.OfType <DataRow>(); var row = new ProviderRowFinder().FindRow( factory.GetType(), r => DbProviderFactories.GetFactory(r).GetType() == factory.GetType(), dataRows); if (row == null) { if (factory.GetType() == typeof(SqlClientFactory)) { return("System.Data.SqlClient"); } throw new NotSupportedException(Strings.ProviderNameNotFound(factory)); } return((string)row[invariantNameIndex]); }
public static string GetProviderInvariantName(this DbProviderFactory factory) { IEnumerable <DataRow> dataRows = DbProviderFactories.GetFactoryClasses().Rows.OfType <DataRow>(); DataRow row = new ProviderRowFinder().FindRow(factory.GetType(), (Func <DataRow, bool>)(r => DbProviderFactories.GetFactory(r).GetType() == factory.GetType()), dataRows); if (row == null) { throw new NotSupportedException(Strings.ProviderNameNotFound((object)factory)); } return((string)row[2]); }
public static string GetProviderInvariantName(this DbProviderFactory factory) { DebugCheck.NotNull(factory); const int invariantNameIndex = 2; var row = new ProviderRowFinder().FindRow( factory.GetType(), r => DbProviderFactories.GetFactory(r).GetType() == factory.GetType()); if (row == null) { throw new NotSupportedException(Strings.ProviderNameNotFound(factory)); } return((string)row[invariantNameIndex]); }
public static string GetProviderInvariantName(this DbProviderFactory factory) { DebugCheck.NotNull(factory); const int invariantNameIndex = 2; var dataRows = DbProviderFactories.GetFactoryClasses().Rows.OfType<DataRow>(); var row = new ProviderRowFinder().FindRow( factory.GetType(), r => DbProviderFactories.GetFactory(r).GetType() == factory.GetType(), dataRows); if (row == null) { throw new NotSupportedException(Strings.ProviderNameNotFound(factory)); } return (string)row[invariantNameIndex]; }
public DefaultDbProviderFactoryService(ProviderRowFinder finder = null) { #if NET40 _finder = finder ?? new ProviderRowFinder(); #endif }