Dbproviderfactories.getfactory (Dbprovidername)
DbProviderFactory factory = dbproviderfactorys.getfactory ("System.Data.SqlClient"); Can be changed by configuration
DBConnection conn = Factory. CreateConnection ();
Conn. ConnectionString = .....
Providerinvariantname:
System.Data.SQLite
System.Data.SqlClient
SQLite support, if not supported, will error,
The requested. Net Framework Data Provider could not be found. may not be installed.
Workaround:
Add a provider configuration in Machine.config (C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\ Machine.config), open, about 129 lines, there is a DbProviderFactories configuration section, and then add a SQLITE3. As follows:
<name= "SQLite3 Data Provider" invariant= "System.Data.SQLite" Description = ". NET Framework Data Provider for sqlite3.x" type = "System.Data.SQLite.SQLiteFactory, System.Data.SQLite, version=1.0.66.0, Culture=neutral, publickeytoken= db937bc2d44ff139 "/>
Http://www.cnblogs.com/Don/p/3633098.html
C # dbproviderfactories Multi-database support engineering mode