You seem to have pointed me to how to persist & hydrate a Parent. In our implementation nearly all our classes inherit from the same abstract base class (all 50 of them). The question was not how to polymorphically create ParentA and ParentB from the same table using discriminators, etc. ParentA and ParentB are from different tables with very different content and purposes... but they all have one-to-many reference to a common child table.
Let's say ParentA is a Customer, ParentB is an InvoiceLineItem, and the Child is a generic DiscriptiveFeatures table.
Code:
public abstract class ParentBase
{
private IList<DiscriptiveFeature> m_features;
...
public IList<DiscriptiveFeature> Features
{
get { return m_features; }
set { m_features= value }
}
}
public class DiscriptiveFeature
{
private ParentBase m_parent;
public int FeatureType {...}
public bool Shown {...}
public int SecurityLevel {...}
...
public ParentBase Parent
{
get { return m_parent; }
set { m_parent= value }
}
}
public class Customer : ParentBase
{
... // class specific properties
}
public class InvoiceLineItem: ParentBase
{
... // class specific properties
}
The original question was: "How do I bidirectionaly map the DiscriptiveFeatures/child?