/ Programming

Debug your EF migration

When you write a difficult EF migration, you need to know if it works properly. Of course, you can do a test on database, but sometimes migration can hang up without changing anything in database. EF migration is .NET code too, so you can start a debugger right in migration code.

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

This approach, can be used not only for EF migrations, but in any other unreachable for Visual Studio code.

Original: http://stackoverflow.com/questions/17169020/debug-code-first-entity-framework-migration-codes