Debug code-first Entity Framework migration codes

后端 未结 7 741
悲&欢浪女
悲&欢浪女 2020-11-27 10:16

I\'m using Entity Framework code first in my website and I\'m just wondering if there is any way to debug the migration codes. You know, like setting breakpoints and stuff l

7条回答
  •  再見小時候
    2020-11-27 11:04

    I know that EF Code First Migrations is relatively new tool but don't forget about you are still in .NET.

    So you can use:

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

    After that you can see your InnerException.

    Or you can use try...catch statement like this: Exception handling Entity Framework

提交回复
热议问题