title: Simple example using System.Data.SQLite with Entity Framework 6
body: <p>I am trying to get a simple code first example to work in a console app using SQLite and EF6, however I am running into multiple errors:
  I created a new console project in VS 2015.
  Then install EF (6.1.3) and System.Data.SQLite (1.0.102) via NuGet.</p>
  
  <p>Try to run a simple program:</p>
  
  <pre><code>namespace SQLiteConsole1
  {
      class Person
      {
          public int Id { get; set; }
          public string Name { get; set; }
      }
  
      class MyContext : DbContext
      {
          public DbSet&lt;Person&gt; Persons { get; set; }
      }
  
      class Program
      {
          static void Main(string[] args)
          {
              using (var db = new MyContext())
              {
                  var person = new Person() { Name = "John" };
                  db.Persons.Add(person);
                  db.SaveChanges();
              }
          }
      }
  }
  </code></pre>
  
  <p>This is what my App.Config looks like this:</p>
  
  <pre><code>  &lt;connectionStrings&gt;
      &lt;add name="MyContext" connectionString="Data Source=C:\Temp\Test.sqlite" providerName="System.Data.SQLite" /&gt;
    &lt;/connectionStrings&gt;
    &lt;entityFramework&gt;
      &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /&gt;
      &lt;providers&gt;
        &lt;provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /&gt;
        &lt;provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" /&gt;
      &lt;/providers&gt;
    &lt;/entityFramework&gt;
    &lt;system.data&gt;
      &lt;DbProviderFactories&gt;
        &lt;remove invariant="System.Data.SQLite.EF6" /&gt;
        &lt;add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" /&gt;
      &lt;remove invariant="System.Data.SQLite" /&gt;&lt;add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /&gt;&lt;/DbProviderFactories&gt;
    &lt;/system.data&gt;
  </code></pre>
  
  <p>When I first run this program I get the following error:</p>
  
  <blockquote>
    <p>Unhandled Exception: System.InvalidOperationException: No Entity Framework 
    provider found for the ADO.NET provider with invariant name 
    'System.Data.SQLite'. Make sure the provider is registered in the 
    'entityFramework' section of the application config file."</p>
  </blockquote>
  
  <p>So I change <code>&lt;provider invariantName="System.Data.SQLite.EF6"</code> to <code>&lt;provider invariantName="System.Data.SQLite"</code>, then I get this error:</p>
  
  <blockquote>
    <p>Unhandled Exception:
    System.Data.Entity.Infrastructure.DbUpdateException: An error occurred
    while updating the entries. See the inner exception for details.
    System.Data.Entity.Core.UpdateException: An error occurred while
    updating the entries. See the inner exception for details.
    System.Data.SQLite.SQLiteException: SQL logic error or missing
    database no such table: People</p>
  </blockquote>
  
  <p>What needs to be changed to get this simple example working?</p>