Dipping my toes in the Entity Framework water and having a little trouble figuring out how to build in object inheritance to a model.
Here's the approach I've taken (mostly stolen from: http://www.robbagby.com/entity-framework/entity-framework-modeling-table-per-type-inheritance/)
1) Define a couple tables: ContentItem and News, give News a ForeignKey to ContentItemId
2) Import into VS2008 EF modeler by updating model from DB
3) Delete auto-created relationship (NOTE: instructions above instruct me to delete the property on the object representing the Foreign key... but it never shows in my modeler)
4) Define inheritance, News inherits from ContentItem
5) Map contentitemId to appropriate column in News mapping
6) Try to build
I end up with this:
Error 8 Error 3002: Problem in Mapping Fragment starting at line 1425: Potential runtime violation of table News's keys (News.NewsId): Columns (News.NewsId) are mapped to EntitySet ContentItem's properties (ContentItem.NewsId) on the conceptual side but they do not form the EntitySet's key properties (ContentItem.ContentItemId).
C:\Projects\TAP\TAP.Domain\TAPModel.edmx 1426 15 TAP.Domain
View Complete Post