Random programming things I'd want to remember

Friday, December 29, 2017

Tips for easy class visualization during debugging (Visual Studio/C#)

Note to self, either put this above the class declaration
[DebuggerDisplay("{Id}: {Name}")]
public class Foo
  public int Id {get;set;}
  public string Name {get;set;}
or override ToString() method :) source

Tuesday, December 5, 2017

Entity Framework migration comes up blank

I'm working on an MVC project with code-first Entity Framework SQL Server database and my initial migration script kept coming up as blank. I ran

Add-Migration InitialCreate

command to no avail. I then (consulted stackoverfow.com and) ran

Add-Migration "InitialMigration" -verbose -ProjectName "MyProjectName" -Force

command and that did not help.

This post helped a lot. As it turned out, I had a ghost record in my MigrationHistory table. I cleared it and everything worked.