After turning Lazy Loading off, you can still load the entities by explicitly calling the Load method for the related entities. There are two ways to use Load method Reference to load single navigation property and Collection to load collections , as shown below.
View All. Hemant Joshi Updated date May 01, Next Recommended Reading. Windows 10 Vs Windows Visual Studio Vs Visual Studio Navigation property should be defined as public, virtual.
Context will NOT do lazy loading if the property is not defined as virtual. Lazy loading of the Enrollments collection can be turned off by making the Enrollments property non-virtual as shown in the following example. Lazy loading can be turned off for all entities in the context by setting a flag on the Configuration property to false as shown in the following example.
Download Microsoft Edge More info. Contents Exit focus mode. Eager loading means that the related data is loaded from the database as part of the initial query. Explicit loading means that the related data is explicitly loaded from the database at a later time. Lazy loading means that the related data is transparently loaded from the database when the navigation property is accessed.
Tip You can view the samples under this section on GitHub.
0コメント