August 25, 2015 · entity-framework migration debug 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)  
     System.Diagnostics.Debugger.Launch();

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

Comments powered by Disqus