如何使用断点进入 OnModelCreating 并查看我的逻辑是否错误,或者 ModelBuilder 是否在做我不期望的事情?我看过很多关于如何调试实际迁移的帖子,但没有看到关于如何观察模型代码是如何生成的.
How can I step into OnModelCreating with a breakpoint and see if my logic is wrong or if the ModelBuilder is doing something I'm not expecting? I've seen lots of posts on how to debug the actual migration, but nothing on how to watch how the model code is being generated.
我试图在我的一些实体上实现一些自定义属性,但它被忽略了;我想看看我的配置在生成模型代码时做了什么.
I'm trying to implement some custom attributes on some of my entities, and it's being ignored; I'd like to see what my configuration is doing as it's generating the model code.
推荐答案您应该能够在您的代码中调用 Debugger.Launch().即时调试器应该会在遇到该行时提示您附加调试器.
You should be able to call Debugger.Launch() in your code. The just-in-time debugger should prompt you to attach a debugger when it hits that line.
更多推荐
EF Core 添加迁移调试
发布评论