views:

9

answers:

0

I have classes like

public class Content
{
    // ...
    public virtual IList<Detail> { get; set; }
}
public class Detail
{
    // ...
    public virtual Content Content { get; set; }
    public virtual string Name { get; set; }
}
public class TagDetail : Detail
{
    public virtual Tag Value { get; set; }
}
public class TagCollectionDetail : Detail
{
    public virtual IList<Tag> Value{ get; set; }
}

and I would like to map those details to table

Details -table
contentId    name    type            tagId
1            Tag     Tag             2
2            Tags    TagCollection   1
2            Tags    TagCollection   3
2            Tags    TagCollection   6

Is it possible to group multiple rows to one object with Fluent NHibernate (and how)? I know it's a bad thing to repeat information (Detail.Name, Detail.Type) like that, but searching would be much easier.

Or do I have to map it into two tables?

Details -table
contentId    name    type            tagId
1            Tag     Tag             2
2            Tags    TagCollection

DetailsCollection -table
detailId    tagId
2           1
2           3
2           6