I have a class that holds a list of other classes, as follows:
Code:
// UniqueObject defines the ID attribute.
[NHibernate.Mapping.Attributes.Class(Table="AnalysisData")]
public class AnalysisData : UniqueObject
{
#region Properties
private IList analysisResultsList = new ArrayList();
[NHibernate.Mapping.Attributes.List(Cascade=CascadeStyle.AllDeleteOrphan)]
[NHibernate.Mapping.Attributes.Key(1, Column="AnalysisDataID")]
[NHibernate.Mapping.Attributes.Index(2, Column="AnalysisDataSequence")]
[NHibernate.Mapping.Attributes.OneToMany(3, ClassType=typeof(AnalysisResult))]
public IList AnalysisResultsList
{
get { return this.analysisResultsList; }
set { this.analysisResultsList = value; }
}
}
and
Code:
[NHibernate.Mapping.Attributes.Class(Table="AnalysisResults")]
public class AnalysisResult: UniqueObject
{
#region Properties
private string description;
/// <summary> Textual description</summary>
[NHibernate.Mapping.Attributes.Property]
public string Description
{
get { return this.description; }
set { this.description = value; }
}
// other properties deleted for clarity...
#endregion Properties
}
I understand that to get the list objects to be retrieved, I need a ManyToOne element in the AnalysisResult class, but I don't understand how I attach it if my DOM doesn't have a parent property.
Ideas?
Thanks!
Gene