I have entity object User
and value object Profile
.
public class User : Entity<Guid>
{
...
public virtual Profile Profile { get; set; }
}
public class Profile
{
...
public virtual User User { get; set; }
}
I'm using nhibernate mapping by code and I'm mapping Profile value object in UserMap.cs
as component like Component(c => c.Profile, ProfileMap.Mapping());
ProfileMap.cs
public class ProfileMap
{
public static Action<IComponentMapper<Profile>> Mapping()
{
return c =>
{
...
c.Property(p => p.User);
}
}
}
On unit mapping tests I'm getting error with inner exception message
"Could not determine type for: MyApp.Domain.Model.User, MyApp.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, for columns: NHibernate.Mapping.Column(User)"}
p.s. when I comment out mapping User
property from ProfileMap
and leaving Profile
property in UserMap
mapping works.
this.ProfileComponent(x => x.Profile)
. Or at leastProfileComponent(x => x.Profile, x => x.ProfileMapping())
. – Stefan Steinegger