2017-02-01 7 views
0

ユーザーEF 7 + migration + SQLiteを使用します。しかし、すべての操作がサポートされるわけではありません。エンティティフレームワーク7コアエミュレートがサポートされていません移行操作

サポートされていない操作を手動で実行できますか?

サンプルサンプルを削除します。

私はスキップDropColumnでの移行を適用するか、スキップDropColumnとSQLiteのため

答えて

0

ソリューションの代わりに私のSQLを実行するため

が、私はコードを書くことができます(SQLiteのDropColumnをサポートしていない)migrationBuilder.DropColumnで新しい移行を追加します

public class DB: DbContext 
{ 
    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) 
    { 
     optionsBuilder.ReplaceService<SqliteMigrationsSqlGenerator, SqliteMigrationsSqlGeneratorExt>(); 
    } 
} 

public class SqliteMigrationsSqlGeneratorExt: SqliteMigrationsSqlGenerator 
{ 
    public override IReadOnlyList<MigrationCommand> Generate(IReadOnlyList<MigrationOperation> operations, IModel model = null) 
    { 
     //Remover DropColumn from operations 
     return operations; 
    } 
} 
関連する問題