I have a class that contains some properties. For some architectural reasons, I have an instance of another objet into my class.
Simple example
public class MyEntity {
public MySubEntity SubEntity {get; set;}
}
For this, I create fluent mapping like :
builder.ToTable(MyEntity.CONST_TABLE_NAME);
builder.HasKey(m => m.Id);
builder.Property(m => m.Column1).IsRequired();
builder.Property(m => m.SubEntity.Column2).IsRequired();
I cannot integrate all my subEntity properties into my main entity (my subEntity has its own intelligence). I just want to map my subentity properties, which is NOT stored in a separated table, to myEntity table.
The last line throw an exception :
The expression 'm => m.SubEntity.Column2' is not a valid property expression. The expression should represent a property access: 't => t.MyProperty'.
How can I perform such mapping ?