.net - Using different ADO.NET providers dynamically with Entity Framework -
my application can work different databases sql server, mysql, oracle, postgresql or sqlite. knows how load relevant ado.net assembly (its dll file name known) , find dbproviderfactory
type in it. factory gives me need work database connection on plain ado.net level.
entering entity framework. used use own o/rm want replace ef 6 code first. own o/rm generated sql , ran dbcommand
class. ef seems lot more , require special configuration. can't add assembly references supported database client provider , require deploying files. need solution loads assemblies @ runtime dynamically , finds way there. then, depending on database shall used, deploy dlls required that.
for doesn't work yet. error message postgresql:
system.notsupportedexception: unable determine provider name provider factory of type 'npgsql.npgsqlfactory'. make sure ado.net provider installed or registered in application config.
this happens when try add entity dbset
. database server connection has been opened , schema installation done. (i don't use ef migrations , don't use connection strings open connection myself when needed.) know haven't added specific configuration app.config file. don't file altogether , avoid using completely.
is there api use register required ef? have type , instance of npgsql provider, example. pass ef method use it?
Comments
Post a Comment