You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know you can use .Include() on a query to eager-load a related object.
What I want to do, though, is declare a relationship so that it always eager-loads, e.g. If my Thing object must always have a related OtherThing that I want to have access to:
modelBuilder.Entity<Thing>(entity =>
entity.HasOne(t => t.OtherThing)
.WithMany(o => o.Things)
.HasForeignKey(t => t.OtherThingId)
.EagerLoad(true); // or something like that
Is it possible to achieve this somehow?
The text was updated successfully, but these errors were encountered:
I know you can use
.Include()
on a query to eager-load a related object.What I want to do, though, is declare a relationship so that it always eager-loads, e.g. If my
Thing
object must always have a relatedOtherThing
that I want to have access to:Is it possible to achieve this somehow?
The text was updated successfully, but these errors were encountered: