From the course: ASP.NET Core Identity: Authentication Management

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using lazy loading

Using lazy loading - ASP.NET Core Tutorial

From the course: ASP.NET Core Identity: Authentication Management

Start my 1-month free trial

Using lazy loading

- [Instructor] Lazy Loading is great because it allows the navigation properties to be used without first, assuring that they are loaded. So this is a great way to improve the performance of our applications. But how can we implement the lazy-loading? To implement the lazy-loading, we need to first install the necessary package, which is the Microsoft.EntityFrameworkCore.Proxies. Then next, we need to call the UseLazyLoadingProxies method inside the AddDBContext in our startup.cs clause. And then at the end, we need to change all the entity types' navigation properties to visual properties. So let us go to our Visual Studio, and make all the necessary updates to implement lazy-loading. We are going to start with the first project, so in our Solution Explorer, let us make sure that the Auth20 project is set up as the starting project. If not, you can just right-click, and go to the Set as StartUp Project, or simply change it from the dropdown up here. Then next we need to install the…

Contents