in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

EF with SQLite ADO.NET Will Not Deploy?

Last post 11-08-2011 10:10 PM by heromyth. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 04-29-2009 8:36 AM

    • SC-A9
    • Top 50 Contributor
    • Joined on 10-22-2006
    • Posts 21

    EF with SQLite ADO.NET Will Not Deploy?

     
    On my Vista x86 System with Visual Studio 2008-SP1, I created a simple test app to read/write to the DB using EntityFramework (platform build target=x86). It worked fine.
    I then copied the contents of my bin\debug directory to my Windows 2003 x64 server, and when I run the console app, I get this Exception:


    Unhandled Exception: System.ArgumentException: The specified store provider cannot be found in the configuration, or is not valid. ---> System.ArgumentException: Unable to find the requested .Net Framework Data Provider.  It may not be installed.
       at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
       at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
       --- End of inner exception stack trace ---
       at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
       at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
       at System.Data.EntityClient.EntityConnection..ctor(String connectionString)
       at TestEf.Program.Main(String[ args) in C:\src\testef\Program.cs:line 29

       


       Here are the code lines:


    22        EntityConnectionStringBuilder connBuilder = new EntityConnectionStringBuilder();
    23        connBuilder.Provider = "System.Data.SQLite";
    24        connBuilder.Metadata = @"res://*/TestEf.csdl|res://*/TestEf.ssdl|res://*/TestEf.msl";
    25        connBuilder.ProviderConnectionString = ConfigurationManager.AppSettings["DbParams"];
    26        Console.WriteLine( connBuilder.ProviderConnectionString );
    27        Console.WriteLine( connBuilder.ConnectionString );
    28        Console.ReadLine();
    29        EntityConnection entConnection = new EntityConnection( connBuilder.ConnectionString );
    30        MyEntities myEnts = new MyEntities( entConnection );

    Line 26 shows this:

    data source=.\TestEf.Db;Version=3;UseUTF16Encoding=False;UTF8Encoding=True;Pooling=True;Max Pool Size=100;BinaryGUID=False;FailIfMissing=True;Compress=False;Cache Size=65536

    Line 27 shows this:

    metadata=res://*/TestEf.csdl|res://*/TestEf.ssdl|res://*/TestEf.msl;provider=System.Data.SQLite;provider connection string="data source=.\TestEf.Db;Version=3;UseUTF16Encoding=False;UTF8Encoding=True;Pooling=True;Max Pool Size=100;BinaryGUID=False;FailIfMissing=True;Compress=False;Cache Size=65536


    Here are the contents of the bin directory:


              ..
        6,144 TestEf.Db
       17,408 TestEf.exe
          767 TestEf.exe.config
       26,112 TestEf.pdb
       14,848 TestEf.vshost.exe
          767 TestEf.vshost.exe.config
          490 TestEf.vshost.exe.manifest
      425,984 System.configuration.dll
      667,648 System.Core.dll
       53,248 System.Data.DataSetExtensions.dll
    2,933,248 System.Data.dll
    2,879,488 System.Data.Entity.dll
      839,680 System.Data.SQLite.DLL
      174,080 System.Data.SQLite.Linq.dll
      185,042 System.Data.SQLite.xml
    3,149,824 System.dll
      966,656 System.Runtime.Serialization.dll
      258,048 System.Security.dll
    2,048,000 System.Xml.dll
      139,264 System.Xml.Linq.dll





    Help?!

     

     

    Thanks.

  • 04-29-2009 8:53 AM In reply to

    Re: EF with SQLite ADO.NET Will Not Deploy?

    EF is using the ProviderFactory framework to instantiate the provider.  Have you added the necessary DbProviderFactory information into your config file?  There are details in the readme file and in the CHM file for how to do this.

     

     

  • 04-29-2009 8:58 AM In reply to

    • SC-A9
    • Top 50 Contributor
    • Joined on 10-22-2006
    • Posts 21

    Re: EF with SQLite ADO.NET Will Not Deploy?

     I got it. I will make a new post with a working sample to help out future folks.

  • 01-29-2010 3:41 PM In reply to

    Re: EF with SQLite ADO.NET Will Not Deploy?

     I have the same issue. Can you post your solution please.

  • 03-09-2010 11:23 AM In reply to

    Re: EF with SQLite ADO.NET Will Not Deploy?

     Hi

     As Robert said, the solution is in the documentation:

    You have to add this to the application config file

    <system.data> <DbProviderFactories> <remove invariant="System.Data.SQLite"/> <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite"
    type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /> </DbProviderFactories> </system.data> 

  • 04-08-2010 12:31 AM In reply to

    Re: EF with SQLite ADO.NET Will Not Deploy?

     I'm having the same issue. Adding the DBProviderFactories section to the .config file changed the error message from:

    Unable to find the requested .Net Framework Data Provider.  It may not be installed.

    to:

    Failed to find or load the registered .Net Framework Data Provider.

    It runs fine in the IDE but I can't get it to run on any other computers.

    The error comes in when I try to create my Entities object:

    dbEntities db = new dbPhotoCapsuleEntities(connectionstring);

     Any ideas on what I'm doing wrong?

     

  • 04-16-2010 9:03 AM In reply to

    Re: EF with SQLite ADO.NET Will Not Deploy?

     I got around this by changing the reference to Copy Local = true


    Hope this helps

  • 08-15-2010 11:10 AM In reply to

    • Subba
    • Not Ranked
    • Joined on 08-15-2010
    • Posts 1

    Re: EF with SQLite ADO.NET Will Not Deploy?

    I changed Build\Output path for the TestLinq project to ..\bin\ , consistent with the Test project.

    This makes the sqlite binaries visible to the TestLinq executable.

  • 11-08-2011 10:10 PM In reply to

    Re: EF with SQLite ADO.NET Will Not Deploy?

     The files are including System.Data.SQLite.Linq.dll and System.Data.SQLite.dll

Page 1 of 1 (9 items)
Powered by Community Server (Commercial Edition), by Telligent Systems