public class Template
{
public int TemplateID { get; set; }
public string Name { get; set; }
public IList<int> DocIds { get; set; }
}
public class TemplateMap : ClassMap<Template>
{
public TemplateMap ()
{
Id(x => x.ID).GeneratedBy.Identity();
Map(x => x.Name);
WithTable("Template");
DiscriminateSubClassesOnColumn<string>("TemplateID ").SubClass<Template>("not null", m => { });
}
}
There are two tables: Template and TemplateDocument. They are as follows:
Template
-------------------------
TemplateID int
Name varchar(255)
TemplateDocument
-------------------------
TemplateID int
DocID int
I would like to just return the Template object filled with the DocIDs from the TemplateDocument table for each template (by TemplateID). Is that possible? How do I go about setting up the mapping for this? It seems so simple, yet I can't seem to get this mapping to work.
Thanks.