C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
Java
Learn iOS Programming
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
3
Reply
Can you disable lazy/deferred loading?
Akhil Khare
11y
9.4k
0
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
Lazy loading comes by default in Linq, you can not turn it off. You can although do an explicit loading by doing a ToList() or ToArray(), which essentially iterates over the returned object so that a list or array is created. Or you can also do a foreach just after the query so that the query is executed. Both cases are actually making the query execute immediately.
Arnab Chatterjee
7y
0
http://www.planetofcoders.com/can-you-disable-lazydeferred-loading/
Munesh Sharma
10y
0
Yes, you can turn off the lazy loading feature by setting LazyLoadingEnabled property of the ContextOptions on context to false. Now you can fetch the related objects with the parent object in one query itself.context.ContextOptions.LazyLoadingEnabled = false;
Akhil Khare
11y
0
Message