I have a model looking something like this:
public class Orders
{
public int Id { get; set; }
public string Name { get; set; }
public int TypeId { get; set; }
public string TypeName { get; set; }
}
Id
, Name
and TypeId
are stored in one table, but TypeName
is stored in another as it going to be used multiple places. It is a 1-to-Many
relation where TypeId
is the foreign key.
The type table just has the id and name.
I want to know if it is possible to get the TypeName
without having to make another class to represent the other table. And preferably if it can be done as part of the entity type configuration, so i won’t have to include it every time.
I tried experimenting with .SplitToTable()
but was not able to get it to work. Same thing with .HasOne()
.
8