I have these classes:
class A
{
public virtual Guid Id { get;set; }
public virtual B Data { get; set; }
}
class B
{
public IList<byte[]> InnerData1 { get; set; } // (1)
public IList<C> InnerData2 { get; set; } // (2)
}
class C
{
public int Value1 { get; set; }
public int? Value2 { get; set; }
}
and following mappings for class A:
Id(x => x.Id).GeneratedBy.Guid();
Component(x => x.Data,
m =>
{
m.HasMany(x => x.InnerData1).Element("InnerData1").Not.LazyLoad(); // (1)
m.HasMany(x => x.InnerData2).Element("InnerData2").Not.LazyLoad(); // (2)
});
as setting (1) works ok and it automatically creates a table and references it properly, I have a problem with (2) which is throwing an exception:
Could not determine type for: (...), for columns: NHibernate.Mapping.Column(InnerData1)
Why it creates everything ok for IList<byte[]>
and has problems with IList<C>
?
Do I have to set a separate mapping for C ? Is there no other simplier way? I would prefer not to add any additional ID column to my model there in C.