none
Connection string for SQLite with Entity Framework code-first approach RRS feed

  • Question

  • The connection string I'm using doesn't work.

    I'm using SQLite & Entity Framework in a code-first approach. I downloaded System.Data.SQLite from NuGet.

    Is code-first approach of Entity Framework supported by SQLite database?

    App config connection string:

    <connectionStrings>
        <add name="LaptopContext" connectionString="Data Source = C:\Users\anila\Documents\SampleDemo1.db; Version = 3;" providerName="System.Data.EntityClient" />
    </connectionStrings>

    Add-Migration command doesn't work.

    Error message: Keyword not supported: 'data source'.

    What connection string should I use?

    Tuesday, October 6, 2015 7:44 PM

Answers

  • Is code-first approach of Entity Framework supported by SQLite database?

    Code First requires no additional provider functionality beyond these. More info from http://stackoverflow.com/questions/4428590/sqlite-with-ef-code-first

    >> No MigrationSqlGenerator found for provider 'System.Data.SQLite'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators.

    You have to contact to author of SQLite provider to check if there is a code first migration project for EF. Or maybe you could create a new one by yourself. EF source code in CodePlex cloud help you.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, October 8, 2015 5:25 AM
    Moderator

All replies

  • After making few changes to App.Config file, I'm getting following error:

    No MigrationSqlGenerator found for provider 'System.Data.SQLite'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators.

    Tuesday, October 6, 2015 9:03 PM
  • Is code-first approach of Entity Framework supported by SQLite database?

    Code First requires no additional provider functionality beyond these. More info from http://stackoverflow.com/questions/4428590/sqlite-with-ef-code-first

    >> No MigrationSqlGenerator found for provider 'System.Data.SQLite'. Use the SetSqlGenerator method in the target migrations configuration class to register additional SQL generators.

    You have to contact to author of SQLite provider to check if there is a code first migration project for EF. Or maybe you could create a new one by yourself. EF source code in CodePlex cloud help you.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, October 8, 2015 5:25 AM
    Moderator