Tips for Good Entity Framework Code First Models

One of the things in programming that you should get right the first time is code first models. Refactoring a database is way more work than normal code, and there will be cases where it’s so much work that it won’t be worth it.

So here’s a few tips from my recent (sometimes painful) refactoring work.

  1. Don’t think about how your model will look as a table, too much. Continue reading

My Entity Framework Code First Checklist

How many times have we all worked on some technology and then wanted to use it again on a different project but couldn’t figure out how to get started? We’ve all done it, and Entity Framework with Code First is definitely one of those technologies that is hard to get started.

…unless you have a checklist. That’s why I’m writing this. It’s my checklist. It helps me start new projects and hopefully it helps you, too. Continue reading

Using Entity Framework 6 with an existing database

DungeonMart’s starter data set is designed for SQL Server, so it’s time to leave DocumentDB behind and start the SQL work. First, I need to create the SQL database and load the seed data. The schema files that I’m using for the initial load can be found here: https://github.com/qanwi1970/dnd-srd-35/tree/master/V1. If you want to follow along, just run them against a new database and you’re good to go.

Since I already have a database, I’m going to use Entity Framework’s database first model to get talking to it quickly. Continue reading