System.Data.SQLite.EF6.Migrations

Entity framework 6.x migration provider for SQLite


Keywords
EntityFramework, Migration, SQLite, ef, entity, framework, migrations
License
MS-PL
Install
Install-Package System.Data.SQLite.EF6.Migrations -Version 1.0.112

Documentation

Project Description
Migrations for Entity Framework 6 SQLite provider

Limitations:

  • Relationships are not enforced with constraints
  • There can be only one identity column per table and will be created as integer and primary key (other primary keys will be ignored)
  • ...

How to use it

  • Download the library (using NuGet)
  • Create a migration configuration
  • Setup the migration configuration (usually during first context creation)

Example

    class Context : DbContext
    {
        static Context()
        {
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<Context, ContextMigrationConfiguration>(true));
        }

        // DbSets
    }

    internal sealed class ContextMigrationConfiguration : DbMigrationsConfiguration<Context>
    {
        public ContextMigrationConfiguration()
        {
            AutomaticMigrationsEnabled = true;
            AutomaticMigrationDataLossAllowed = true;
            SetSqlGenerator("System.Data.SQLite", new SQLiteMigrationSqlGenerator());
        }
    }