Entity Framework

Lazy Loading in Entity Framework

Lazy loading in Entity Framework is the technique where the Entity Framework delays the loading of an entity or collection of entities until the time application actually needs it. In this tutorial, we learn about lazy loading. The difference between lazy loading and eager loading. How it works. How to disable it for all entities, for a specific entity or to a specific query.

Lazy Loading in Entity Framework Read More »

Entity Framework Logging Database Queries

Entity Framework starting from Version 6.0 allows us to log the commands & queries sent to the database. The Logging is done by using the DbContext.Database.Log property, which can be set to a delegate for any method that takes a string. All the actions performed by the Entity Framework is logged, which includes opening a connection, closing a connection, database initialization , Add, Edit, Insert & Select Queries, etc

Entity Framework Logging Database Queries Read More »

Join Query In Entity Framework

In this tutorial let us look into how to use Join Query in Entity Framework to load the data from two, three or more tables. The LINQ join operator allows us to join multiple tables on one or more columns (multiple columns). By default, they perform the inner join of the tables. We also learn how to perform left joins in Entity Framework by using the join operator & DefaultIfEmpty method.

Join Query In Entity Framework Read More »

Load Related Entities in Entity Framework

In this tutorial let us look into how to load the Related Entities in Entity Framework. We can load Related Entities either eager, lazy or explicit. Be default the EF loads the lazily. But you can instruct it load eagerly using the include method. Or else you can make use of projection queries to load the data. The other option is to load the data explicitly using the load method of the context. In the explicit method, we decide when to load the data.

Load Related Entities in Entity Framework Read More »

Scroll to Top