I have an class structure like this:
public class BaseEntity
{
public Guid Id { get; set; }
}
// CREATE TABLE Project (Id, Name)
public class Project : BaseEntity
{
public ProjectProperties Properties { get; set; }
public string Name { get; set; }
}
// CREATE TABLE ProjectProperties (Id, Markup)
// ForeignKey from ProjectProperties.Id -> Project.Id
public class ProjectProperties : BaseEntity
{
public int Markup { get; set; }
}
What is the correct way to map this using NH 3.2 and Mapping By Code? I can't find examples where the 1:1 relationship is through the PKs.
you can use Join since the primary keys match. it doesn't even need an own Id because it is dependant from Project