SQLite Entity Framework ADO.NET Error -


i trying implement data service based on ef (6.1.3) , sqlite. have working in small test app, can't see duplicate experience. data service class library has system.data.sqlite.... components loaded. loaded sqlite.codefirst read create functions in ef 6.1.3 not complete sqlite. however, error when data service called is:

system.invalidoperationexception occurred hresult=0x80131509 message=no entity framework provider found ado.net provider invariant name 'system.data.sqlclient'. make sure provider registered in 'entityframework' section of application config file. see http://go.microsoft.com/fwlink/?linkid=260882 more information. 

i think must in app.config file, can't seem find out whats wrong configuration.

here code context class.

    public class irmcontext : dbcontext {     public dbset<operator> operators { get; set; }     protected override void onmodelcreating(dbmodelbuilder modelbuilder)     {         base.onmodelcreating(modelbuilder);         var sqlliteinit = new sqlitedropcreatedatabasewhenmodelchanges<irmcontext>(modelbuilder);         database.setinitializer<irmcontext>(sqlliteinit);     } } 

and app.config file.

<?xml version="1.0" encoding="utf-8"?> <configuration>     <configsections>         <section name="entityframework"   type="system.data.entity.internal.configfile.entityframeworksection,   entityframework, version=6.0.0.0, culture=neutral,   publickeytoken=b77a5c561934e089" requirepermission="false"/>  </configsections>     <startup>         <supportedruntime version="v4.0" sku=".netframework,version=v4.6.1"/>   </startup>   <runtime>       <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">       <dependentassembly>           <assemblyidentity name="system.data.sqlite" publickeytoken="db937bc2d44ff139" culture="neutral"/>     <bindingredirect oldversion="0.0.0.0-1.0.96.0" newversion="1.0.96.0"/>   </dependentassembly> </assemblybinding> </runtime> <connectionstrings>     <add name="irmcontext" connectionstring="data source=c:\irmanager\irmanager.sqlite" providername="system.data.sqlite"/> </connectionstrings>     <entityframework>     <defaultconnectionfactory type="system.data.entity.infrastructure.localdbconnectionfactory, entityframework">   <parameters>     <parameter value="v13.0"/>   </parameters>     </defaultconnectionfactory>     <providers>        <provider invariantname="system.data.sqlite" type="system.data.sqlite.ef6.sqliteproviderservices, system.data.sqlite.ef6"/>        <provider invariantname="system.data.sqlclient" type="system.data.entity.sqlserver.sqlproviderservices, entityframework.sqlserver"/>    </providers>    </entityframework>    <system.data>    <dbproviderfactories>         <remove invariant="system.data.sqlite.ef6"/>         <add name="sqlite data provider (entity framework 6)" invariant="system.data.sqlite.ef6" description=".net framework data provider sqlite (entity framework 6)" type="system.data.sqlite.ef6.sqliteproviderfactory, system.data.sqlite.ef6"/>         <remove invariant="system.data.sqlite"/>         <add name="sqlite data provider" invariant="system.data.sqlite" description=".net framework data provider sqlite" type="system.data.sqlite.sqlitefactory, system.data.sqlite"/>     </dbproviderfactories>  </system.data> </configuration> 

any help/pointers appreciated. thanks

i traced problem down 2 issues.

  1. the config string needed in actual application app.config file, not in app.config class library.
  2. the application needs have sqlite installed appears want load sqlite app not library.

my main issue seems of experience sqlite has been in uwp applications not case.

thanks.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -