1 Star 0 Fork 0

JessGitHub / Link.EntityFramework.Sqlite

Create your Gitee Account
Explore and code with more than 8 million developers,Free private repositories !:)
Sign up
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
ReadMe.md

Link.EntityFramework.Sqlite —— Entity Framework 6 Sqlite

NuGet

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)
  • ...
  • can not change primary key column

Simplest Usage

  • Download the library (using NuGet)
  • Create a migration configuration
  • Setup the migration configuration (usually during first context creation)
internal sealed class ContextMigrationConfiguration : DbMigrationsConfiguration<Context>
{
    public ContextMigrationConfiguration()
    {
        AutomaticMigrationsEnabled = true;
        AutomaticMigrationDataLossAllowed = true;
    }
}

Old Version Example

Not Realy Delete Column,Just Rename Column

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

    // DbSets
}

New Version Example

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

    // DbSets
}

Fix

Implementation

  • Drop Column Imp
    • Rename Column
    • Record Delete Column Info
    • Add Additional Migration
      • Create Temp Table Base Record Info
      • Copy Data To Temp Table
      • Drop Original Table
      • Rename Temp Table
  • Alter Column Imp
    • Similar Drop Column
    • Alter Column Will Migrate Data Column By Column

Refrence

About SQLite

  • Boolean need set default 0/1, not True/False - add column
    • System.Data.Sqlite cast error for True/False - GetBoolean

About

Migrations for SQLite Entity Framework provider —— Code First Support expand collapse
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
C#
1
https://gitee.com/JessGitHub/Link.EntityFramework.Sqlite.git
git@gitee.com:JessGitHub/Link.EntityFramework.Sqlite.git
JessGitHub
Link.EntityFramework.Sqlite
Link.EntityFramework.Sqlite
master

Search