0

I am developing a C# application with EntityFramework and CodeFirst model. I would like to have a local database on each machine and each application installation. What I mean is that when User X installs the application on his machine the application should create and use a local database file. I tried with SQLite but I had no luck making it work with the following connection string and dbFactory in my app.config

<connectionStrings>
    <add name="FaceBotDb"
          connectionString=
"Data Source=|DataDirectory|FaceBotDb.sqlite"
          providerName="System.Data.SQLite" />
  </connectionStrings>
  <system.data>
    <DbProviderFactories>
      <add name="SQLite Data Provider"
            invariant="System.Data.SQLite"
            description="Data Provider for SQLite"
            type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
    </DbProviderFactories>
  </system.data>

I get exception of the sort "invariant must be unique". My main question is if SQLite is my best choice in such case. Is there any other Database which can use EntityFramework and store it's files locally. Please note that I can use SQLite with pure ADO.NET but that's going to happen only if I have no other choice since EF has a lot of benefits.

2
  • 1
    I would use SQLCe, there are nuget packages to help you install it Commented Jul 18, 2013 at 18:15
  • Charlie beat me... SQLCe is the better choice Commented Jul 18, 2013 at 18:17

1 Answer 1

1

"Microsoft SQL Server Compact Edition" is the best alternative for SQLite. It stores it's files locally and almost all of ORMs support it.

The best way to install it in your project is using Nuget at http://nuget.org/packages/SqlServerCompact/

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you and thank you to the guys who posted their comments, this was extremely helpful information !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.