The following depicts my Model and Mapping Code as of now:
public class ChildData
{
public virtual long Id {get;set;}
public virtual DateTime DateOfCreation { get; set; }
public virtual ParentData Parent { get; set; }
}
public class ParentData
{
public virtual DateTime ValidFrom { get; set; }
public virtual DateTime ValidTo { get; set; }
public virtual int ParentId { get; set; }
public virtual IList<ChildData> Children { get; set; }
}
public class ChildMap : ClassMap<ChildData>
{
public ChildMap()
{
Id(x => x.Id).GeneratedBy.Identity();
References(x => x.Parent).Column("ParentId"); // won't
work,the other side defines a combined key over 3 cols!
}
}
public class ParentMap : ClassMap<ParentData>
{
public ParentMap()
{
CompositeId().KeyProperty(x => x.ParentId, "parentId")
.KeyProperty(x => x.ValidFrom, "validFrom")
.KeyProperty(x => x.ValidTo, "validTo");
HasMany(x => x.Children).KeyColumn("parentId"); //will
return too many,need to restrict to those created in my validity
period
}
}
Now, what I need to do is restrict the data so that
`ChildData.DateOfCreation` is Between `ParentData.ValidFrom` and
`ParentData.ValidTo`. This should be used to initialize both the
collection in the ParentData and the reference in the ChildData.
Can anybody help me out with the Syntax?
Thanks a lot in advance,
Sebi
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.