As part of hunting for a new employer (an unfortunate necessity due to layoffs), I’ve been re-acquainting myself with the .NET stack after a couple of years building and managing teams of J2EE developers. MSDN has a handy article on Entity Framework Code First, but the last update was about a year ago and some of the information hasn’t aged so well.
The first 3 steps in the article went as planned (I’m using Visual Studio 2017 Community Edition). But once I got to step 4, neither of the suggested locations of the database worked per the instructions. A quick look in App.config revealed what I was missing:
Once I provided the following value for the server name:
database I could connect to revealed themselves and I was able to inspect the schema. Steps 5-7 worked without modifications as well. My implementation of the sample diverged slightly from the original in that I refactored the five classes out of Program.cs into separate files. This didn’t change how the program operated at all–it just made for a simpler Program.cs file. The code is available on GitHub.