I have to optimize my Entity Framework queries as the generated SQL is getting more and more complex because of multiple .Include(...)
statements.
Instead of using Includes, I started to use explicit loading which is nice, since I have some small tables which are better to be loaded explicitly by the Load method of QueryableExtensions.
However, I cannot find an easy way to explicitly load my mapping tables for many-to-many connected tables - since the mapping table is not mapped to a DbSet...
I use Code First with mappings like this:
modelBuilder.Entity<SomeEntity>()
.HasMany(a => a.SomeProperty)
.WithMany()
.Map(c =>
{
c.ToTable("MappingTable");
});
Is there any easy way to explicity load the MappingTable without mapping them?