I have a class that contains some properties. For some architectural reasons, I have an instance of another object in my class.
Simple example
public class MyEntity { public MySubEntity SubEntity {get; set;} }
To do this, I create a free display, for example:
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 of my subEntity properties into my core entity (my subEntity has its own intelligence). I just want to map my subentity properties, which are NOT stored in a separate table, in the myEntity table.
The last line throws 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 do this mapping?
source share