msallin / SQLiteCodeFirst

Creates a SQLite Database based on a EdmModel by using Entity Framework CodeFirst.
Apache License 2.0
610 stars 123 forks source link

How to create SQlite Db #134

Closed Ascolon closed 6 years ago

Ascolon commented 6 years ago

Hey. I installed the library and I want to create a database. I created classes for the table model my file Apppionfig look like this My context looks like this

<connectionStrings>
     <add name = "HRConnection" connectionString = "Data Source =. \ HR.db" providerName = "System.Data.SQLite" />
   </ connectionStrings>
public class HRContext: DbContext
     {
         protected override void OnModelCreating (DbModelBuilder modelBuilder)
         {
             var sqliteConnectionInitializer = new SqliteCreateDatabaseIfNotExists <HRContext> (modelBuilder);
             Database.SetInitializer (sqliteConnectionInitializer);
         }
         public DbSet <Associate> Associates {get; set; }
         public DbSet <AssociateGroup> AssociateGroups {get; set; }
     }

But I'm getting an exception

  1. file not found
  2. SQL Server not found