WARNING: EF Code first may only be appropriate for children
I would like to warn anybody who wants to use code first (specifically TPC inheritance) to only use it when you plan to stick with the simple scenarios that you’ve already seen proven out through examples on the web. Once you begin to stray from these examples, you’ll find yourself with code that doesn’t work with no way to fix it (since, per the Microsoft way, the important classes are all “private internal”). Here are just a few examples of limitations that I’ve encountered:
1) If you want an entity base class that is not abstract (to, say, work around a bug in RIA services) with a TPC (Table per Concrete Type) configuration, forget about it… there is absolutely no way to do it.
2) Generic types are not supported as entities or as entity base types.
3) If you want to define the properties on your entity at runtime, using ICustomTypeProvider or IDynamicMetaObjectProvider… again, forget about it.
I could go on and on, but the point is that I’ve run into more “not supported” scenarios with this library than almost any other I’ve ever used. That said, I love the concept… and once EF code first becomes at all extensible, I’ll fully support it.