Debugging Package Manager Console Update-Database Seed Method

前端 未结 7 798
北恋
北恋 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:33

    Here is similar question with a solution that works really well.
    It does NOT require Thread.Sleep.
    Just Launches the debugger using this code.

    Clipped from the answer

    if (!System.Diagnostics.Debugger.IsAttached) 
        System.Diagnostics.Debugger.Launch();
    

提交回复
热议问题