Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to declare a relationship as eager loaded? #8425

Closed
shaulbehr opened this issue May 9, 2017 · 1 comment
Closed

Is it possible to declare a relationship as eager loaded? #8425

shaulbehr opened this issue May 9, 2017 · 1 comment

Comments

@shaulbehr
Copy link

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?

@anpete
Copy link
Contributor

anpete commented May 9, 2017

See #1985, #2953

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants