Archives / 2014 / June
  • Polymorphic Associations in Entity Framework

    In this post I'm going to show how to use EF 6.1 Code First to model polymorphic associations between a base class and two derived classes. In EF this is called "table-per-type" (TPT) inheritance. Microsoft has a walkthrough on using EF to map TPT inheritance in a domain model. Unfortunately it was written before EF Code First and is now dated. A search turned up some information here and there but it too was dated. It took me the better part of an afternoon to get it working in EF Code First so I thought I should post the solution. Continue reading...