Hi, I'm having a "Day" domain model which has some related "PersonalPlans".
There are also classes which inherit from PersonalPlan (like OperatorPlan).
I'd like to be able to retrieve the collection of, lets say, OperatorPlans.
How do I map it properly?
(i'm skipping primary keys and other fields unimportant in this question.)
domain classes:
public class Day {
public virtual IList<PersonPlan> PeoplePlans { get; set; }}public class
PersonPlan{
public virtual Day Day { get; set; }}public class OperatorPlan: PersonPlan
{}
mappings:
public class OperatorPlanMap: SubclassMap<OperatorPlan> {
public OperatorPlanMap() {
// some stuff
}}
public class PersonPlanMap: ClassMap<PersonPlan> {
public PersonPlanMap() {
Id(x => x.Id);
References(x => x.Day).Not.Nullable();
}}
public class DayMap: ClassMap<Day> {
public DayMap() {
// ...
HasMany(x => x.PeoplePlans);
}}
now whenever I create a new PersonPlan or one of it's subtypes (like
OperatorPlan), it is available through Day.PeoplePlans.
Now I'd like to be able to map a collection of *specific type only*, like
so:
public class Day {
public virtual IList<PersonPlan> PeoplePlans { get; set; }
public virtual IList<OperatorPlan> OperatorPlans { get; set; }}
*How do I map* OperatorPlans *correctly?*
Putting simply HasMany(x => x.OperatorPlans) causes the database table to
be extended with one new column, Day_Id. It seems that the "hierarchical"
relation (through PersonPlan) is being ignored in that case.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/groups/opt_out.