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

Alternative to Telerik FetchStrategy for eager loading? #24273

Closed
mythjuha opened this issue Feb 25, 2021 · 2 comments
Closed

Alternative to Telerik FetchStrategy for eager loading? #24273

mythjuha opened this issue Feb 25, 2021 · 2 comments

Comments

@mythjuha
Copy link

I'm currently migrating from Telerik Data Access.

Is there an EF core alternative to the following method used by 'Telerik Data Access' to define eager loading? I find this implementation to be quicker/simpler then the 'Include/ThenInclude' method. Especially when wanting to load multiple properties of an already navigational property.

            var fetchStrategy = new Telerik.OpenAccess.FetchOptimization.FetchStrategy();
            fetchStrategy.LoadWith<Course>(c => c.CourseEvents);
            fetchStrategy.LoadWith<Course>(c => c.PersonRegistrations);
            fetchStrategy.LoadWith<PersonCourseRegistration>(r => r.Person);
            fetchStrategy.LoadWith<PersonCourseRegistration>(r => r.Attendances);
            fetchStrategy.LoadWith<PersonCourseRegistration>(r => r.EmployerRegistration);
            fetchStrategy.LoadWith<Person>(p => p.Employers);
            fetchStrategy.LoadWith<EmployerService>(m => m.Role);
            fetchStrategy.LoadWith<EmployerCourseRegistration>(r => r.Employer);

            var courses = this.Database.GetAll<Course>()
                                  .LoadWith(fetchStrategy)
                                  .ToList();
@roji
Copy link
Member

roji commented Feb 25, 2021

It seems like you're looking for explicit loading, though I'm not familiar with Telerik Data Access so I could be wrong. Though be aware of adding extra unneeded database roundtrips with this kind of technique - this makes especially little sense with one-to-one (reference) navigations, where eagerly loading with Include is more efficient.

If this doesn't correspond to what you're looking for, please post a more complete description of what you need.

@ajcvickers
Copy link
Member

ajcvickers commented Feb 25, 2021

@mythjuha This feature is tracked by #2953. Please upvote there.

@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