Hi guys,
I am having an issue with Entity Framework and object inheritance.
Object Concept:
Base class - Market
Derived Classes - SingleMarket
/ CombinedMarket
Both of the SingleMarket and CombinedMarket should be based on the Market Class. However I only have one "Market" table in the database. The Database table has a column called "Type" which in it I store an indicator to say if this is a Single/Combined Market. So far so good, this concept works.
Now my issue,
The Combined market is made up of 2 or more single markets, in essence it is a "group"
I have created a table called "Market_Market" which has two columns, "ParentMarketID" and "ChildMarketId", this estabilishes a "many to many" relationship for the markets in the base form.
From an object perspective, I want to have a "SingleMarket" object and a "CombinedMarket" object, the CombinedMarket object should have a navigation property on it to link it "ChildMarkets" but I'm not sure how to move this navigation property from the base Market class to the derived CombinedMarket.
I don't want the property to be available on the SingleMarket.
I hope I've explained this clearly enough for you to understand my issue, if not ask questions and I will try and clarify.
Thanks.