My database looks something like the following:
dbo.Products Table:
Id | int
Status | tinyint
dbo.ProductNames Table:
ProductId | int
Name | nvarchar(4000)
And a simplifed version of the code would be:
public class Product{
public int Id { get; set; }
public string Name { get; set; }
public ObjectStatus Status { get; set; }
}
public class ProductEntityConfiguration : EntityConfiguration<Product> {
public ProductEntityConfiguration() {
ToTable("Products");
HasKey(p => p.Id);
Property(p => p.Id).HasColumnName("Id");
Property(p => p.Status).HasColumnName("Status");
}
}
How can I map the product name, which exists in a different table as a normal property, so that if someone requests it, E.F. must join the two tables by the Id?