Discussion on lazy-loading of navigation properties
See original GitHub issueNote:
- Issue #10509 has been created to track actual work on lazy-loading. The new issue is locked so that it can be subscribed to for updates on the implementation without noise.
- This issue has been re-purposed to be discussion about lazy-loading in EF Core. It will not (for the time being) be locked because it is important to us that we don’t shut down channels of communication with the community.
With regard to feedback, I think it is worth reiterating some comments made a few months ago. We read and consider all feedback (and try to make the right choices based on it) no matter how it is delivered; that is, whether it is provided politely and with respect or not. Yelling at us or others with different opinions at best makes you feel good and us/them feel bad. It doesn’t achieve anything concrete. We are doing our best to prioritize features and implement them in the best way we can. We really appreciate your feedback and it makes a big difference on shaping the product. We personally appreciate it more when feedback is delivered in a respectful way, but please don’t stop providing constructive feedback.
Original issue:
Hi,
i was wondering if I am the only one that thinks EF Core is useless without Lazy Loading? Or do I do something wrong? Lets just consider a simple scenario when a course provider cancels a course on a course booking plattform written in MVC.
The user calls courses/cancel/1. The action would get the course and call cancel method like here
Course course = context.Courses.SingleOrDefault(c => c.Id = 1);
course.Cancel();
The cancel method then needs to cancel each booking on the course so it would do something like this
foreach(Booking booking in this.Bookings)
{
booking.Cancel();
}
The booking in turn would refund the transaction
foreach(Transaction transaction in this.Transactions)
{
transaction.Refund();
}
So for this to work, lazy loading is needed?! (The solution would be to eager load all the data on the controllers action method. But I do not know what will be needed from the controller?)
I’d appreciate any information on that.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:149
- Comments:231 (48 by maintainers)
Top GitHub Comments
+1 for lazy load
I would downvote this if possible, lazy loading is a source of problem, and hides some db work. Explicit is better than implicit IMHO! I prefer EF Core never implement this.