Can one set a breakpoint in EF code first migrations seed method?

前端 未结 2 1042
迷失自我
迷失自我 2020-12-31 02:17

I am having trouble with something in the Seed method in the Configure.cs for my entity framework 6 code-first migration process. I am running the

2条回答
  •  被撕碎了的回忆
    2020-12-31 02:43

    It's not possible directly within source code but you can attach the debugger via source code. Please see this link for details:

    if (System.Diagnostics.Debugger.IsAttached == false)
       System.Diagnostics.Debugger.Launch();
    

    The other option would be to run the migration via source code as explained above:

    var configuration = new Configuration();
    var migrator = new DbMigrator(configuration);
    migrator.Update();
    

提交回复
热议问题