I have a couple of classes and you want to map them correctly to the database:
public class A { public virtual Guid Id { get; private set; } public virtual ComponentClass Component { get; set; } } public class ComponentClass { public virtual IList<B> Elements { get;set; } } public class B { public virtual Guid Id { get; private set; } public virtual DateTime Time { get; set; } }
I match them using smooth comparisons:
public class AMap : ClassMap<A> { public A() { Id(x => x.Id); Component(x => x.Component, c => c.HasMany(x => x.Elements).Inverse().Cascade.All()); } } public class BMap : ClassMap<B> { public B() { Id(x => x.Id); Map(x => x.Time); } }
When I save my entity, I have class A mapped to one table and class B to another, as expected. But I have zeros in the Component_id column. Can you tell me what I am missing here?
source share