Debugging Package Manager Console Update-Database Seed Method

前端 未结 7 793
北恋
北恋 2020-12-07 12:53

I wanted to debug the Seed() method in my Entity Framework database configuration class when I run Update-Database from the Package Manager Console

7条回答
  •  太阳男子
    2020-12-07 13:24

    The way I solved this was to open a new instance of Visual Studio and then open the same solution in this new instance of Visual Studio. I then attached the debugger in this new instance to the old instance (devenv.exe) while running the update-database command. This allowed me to debug the Seed method.

    Just to make sure I didn't miss the breakpoint by not attaching in time I added a Thread.Sleep before the breakpoint.

    I hope this helps someone.

提交回复
热议问题