Entity Framework and SQLite

Discussion in 'ASP.NET / ASP.NET Core' started by pompair, Feb 26, 2009.

  1. I'm experimenting with Entity Framework and SQLite database on my discountasp.net site. As far as I know, Entity Framework and SQLite are bin deployable.

    In my bin folder I have (among other things):
    System.Data.Entity.dll
    System.Data.Entity.Design.dll
    System.Data.SQLite.dll
    System.Data.SQLite.Linq.dll

    Web.config (** is the real path which I wish not to disclose here)
    <remove name='LocalSqlServer' />
    <add name='booksEntities' connectionString='metadata=~/bin/Models\Books.csdl|~/bin/Models\Books.ssdl|~/bin/Models\Books.msl;provider=System.Data.SQLite;provider connection string='data source=**PATH TO MY DATABASEFILE (books.s3db)**'' providerName='System.Data.EntityClient' />

    <add assembly='System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' />
    <add assembly='System.Data.SQLite, Version=1.0.60.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' />
    <add assembly='System.Data.SQLite.Linq, Version=2.0.38.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' />

    I'm getting the following error:

    [ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.]
    System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +1308959
    System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +35

    Any ideas?

    Timo
     
  2. Hi,
    There were a few requests for this last year so I told Bruce I'd try it but ended up giving up on it, never got it to work.
    Just looking at the code you posted those forward and back slashes and pipe commands can't be right, can they? Sure looks odd.
    Salute,
    Mark
    i.e. ~/bin/Models\Books.csdl|~/bin/Models\Books.ssdl|~/bin/Models\Books.msl

    Technical Evangelist for DiscountASP.NET

    Find ASP.NET code samples with my Dev Coop search tools below.
    Google
    Microsoft

    DiscountASP.NET Technical Webcasts:
    http://www.iis7test.com/webcasts/

    My Microsoft Technical Blogs
    http://weblogs.asp.net/markwisecarver/
    http://blogs.windowsclient.net/wisecarver/default.aspx
     
  3. Put this in your Web.Config file:

    <configuration>
    <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>
    </configuration>
     

Share This Page