Here are the examples of the csharp api class System.Data.Common.DbProviderFactories.GetFactoryClasses() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
15 Examples
0
1. Example
View license[Test] public void DisplayProviders() { var table = DbProviderFactories.GetFactoryClasses(); foreach (DataRow row in table.Rows) { foreach (DataColumn column in table.Columns) { Console.WriteLine(column.ColumnName + ":" + row[column]); } Console.WriteLine("-------------------------------------------------"); } }
0
2. Example
View licensepublic static DataTable GetAvailableDB() { DataTable dt = DbProviderFactories.GetFactoryClasses(); dt.Rows.Add(new object[] { "SQLite Data Provider", ".Net Framework Data Provider for SQLite", SQLiteName, "System.Data.SQLite.SQLiteFactory, System.Data.SQLite" }); return dt; }
0
3. Example
View licenseprivate static DbProviderFactory GetProvider(string providerName) { bool hasProvider = DbProviderFactories.GetFactoryClasses().Rows.OfType<DataRow>() .Select(r => (string)r["InvariantName"]) .Contains(providerName, StringComparer.OrdinalIgnoreCase); if (hasProvider) { return DbProviderFactories.GetFactory(providerName); } return null; }
0
4. Example
View license[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spel/n ..... /n //View Source file for more details /n }
0
5. Example
View licensepublic static void Configure() { if (!configured) { lock (syncRoot) { if (!configured) { var factories = DbProviderFactories.GetFactoryClasses(); AppDomain.CurrentDomain.SetData("DataDirectory", AppDomain.CurrentDomain.BaseDirectory); //SQLite foreach (ConnectionStringSettings cs in ConfigurationManager.ConnectionStrings) { var factory = factories.Rows.Find(cs.ProviderName); if (factory == null) { throw new ConfigurationErrorsException("Db factory " + cs.ProviderName + " not found."); } RegisterDatabase(cs.Name, cs); } configured = true; } } } }
0
6. Example
View licenseprivate static string ParseProviderName(string name) { DataTable dt = DbProviderFactories.GetFactoryClasses(); List<string> providers = new List<string>(); foreach (DataRow row in dt.Rows) { providers.Add(row["InvariantName"].ToString()); } foreach (string provider in providers) { if (Regex.IsMatch(provider, name, RegexOptions.IgnoreCase)) return provider; } SqlException exception = new SqlException("????????? {0} ?? ??????"); exception.Data.Add("{0}", name); throw exception; }
0
7. Example
View licenseprivate static DbProviderFactory GetProvider(string providerName) { if ( DbProviderFactories.GetFactoryClasses().Rows.OfType<DataRow>() .Select(r => (string)r["InvariantName"]) .Contains(providerName, StringComparer.OrdinalIgnoreCase)) { return DbProviderFactories.GetFactory(providerName); } return null; }
0
8. Example
View licenseprivate static DbProviderFactory GetProvider(string providerName) { if ( DbProviderFactories.GetFactoryClasses().Rows.OfType<DataRow>().Select( delegate(DataRow r) { return (string)r["InvariantName"]; }).Contains(providerName, StringComparer. OrdinalIgnoreCase)) { return DbProviderFactories.GetFactory(providerName); } return null; }
0
9. Example
View licenseprotected string TranslateProviderName(string providerName) { var providers = new List<string>(); foreach (DataRowView item in DbProviderFactories.GetFactoryClasses().DefaultView) providers.Add((string)item[2]); var invariantNames = providers.FindAll(p => p.ToLowerInvariant()==providerName.ToLowerInvariant()); if (invariantNames.Count==1) return invariantNames[0]; else if (invariantNames.Count>1) throw new ArgumentException(string.Format("More than one Provider can be returned based on providerName given: '{0}'", providerName)); return null; }
0
10. Example
View licenseprivate static DbProviderFactoryClass[] GetDbProviderFactoryClasses() { List<DbProviderFactoryClass> list = DbProviderFactories.GetFactoryClasses().ToList<DbProviderFactoryClass>(); var types = typeof(DbProviderFactory).GetSubClass().Where(t => !t.IsAbstract); foreach (Type type in types) { if (!list.Any(item => item.AssemblyQualifiedName == type.AssemblyQualifiedName || item.InvariantName == type.Namespace)) { DbProviderFactoryClass item = new DbProviderFactoryClass(); string name = type.Name.Replace("Factory", ""); item.Name = name + " Data Provider"; item.Description = ".NET Framework Data Provider for " + name; item.InvariantName = type.Namespace; item.AssemblyQualifiedName = type.AssemblyQualifiedName; list.Add(item); } } DbProviderFactoryClass[] factories = list.Where( item => { Type type = null; return Types.TryGetType(item.AssemblyQualifiedName, out type); }).ToArray(); return factories; }
0
11. Example
View license[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spel/n ..... /n //View Source file for more details /n }
0
12. Example
View license[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spel/n ..... /n //View Source file for more details /n }
0
13. Example
View license[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] internal sta/n ..... /n //View Source file for more details /n }
0
14. Example
View licenseprotected override void EndProcessing() { try { Pred/n ..... /n //View Source file for more details /n }
0
15. Example
View licensestatic void Main(string[] args) { try { Console.Writ/n ..... /n //View Source file for more details /n }