How to ignore a table/class in EF 4.3 migrations

前端 未结 2 1692
醉酒成梦
醉酒成梦 2020-12-08 17:44

I\'m testing with EF 4.3 (beta)

I have some new classes which should generate db tables and columns.

From a old project i have some old tables in my schema,

2条回答
  •  孤城傲影
    2020-12-08 18:18

    With EF 4.3.1 released there is built in support for this scenario. When adding classes that are mapped to existing tables in the database, use the -IgnoreChanges switch to Add-Migration.

    This will generate an empty migration, with an updated meta-data signature that contains the newly added classes.

    Usually this is done when starting using EF Migrations, hence the "InitialMigration" name:

    Add-Migration InitialMigration –IgnoreChanges
    

提交回复
热议问题