Entity Framework – Debugging a Seed method from the Package Manager Console

On the odd occasion you wish to debug Seed method code which has been executed from the Package Manager Console using the Update-Database command, a quick and dirty method is to add the following code:

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

Yes it’s dirty! It will however fire up a new Visual Studio debug window and allow you to see what’s going on inside.

Leave a Reply

Your email address will not be published. Required fields are marked *