I have a mapped class that has a ICollection property which is mapped as a Set (using by code mappings). Note that the collection contains strings and not another mapped entity. e.g.
public class Item
{
public virtual ICollection<string> Facts { get; set; }
}
public class ItemMapping
{
public ItemMapping()
{
Set(x => x.Facts, m =>
{
m.Key(k => k.Column("ItemId"));
m.Table("Facts");
}, col => col.Element(m =>
{
m.Column("Description");
m.Type(NHibernateUtil.String);
}));
}
}
This works and CRUD operations on Items with Facts works fine.
However, I want to QueryOver<> the Facts in the database (e.g. retrieve the count or first 20 facts or retrieve some random facts) but given there is no entity how do I do this? I don't want to introduce a Fact entity because the only property it would have would be a string.