I want to configure many to many relationship between 2 entities but I would also like to expose their foreign keys. I found only one concrete solution online like following:
modelBuilder.Entity<E1>()
.HasMany(t => t.E1s)
.WithMany(t => t.E2s)
.Map(m =>
{
m.ToTable("E1E2");
m.MapLeftKey("FKE1");
m.MapRightKey("FKE2");
});
But map left and right key does not take a properties from my models so I do not have access to them and they will not be filled when I query. So, I do not have access to my foreign key properties.
Hope I was able to explain my problem. Can anyone suggest any other option?