Entity Framework Core

EF Core Projection Queries

This tutorial is about Projection queries in EF Core. We use them to create a query that selects specific columns from a set of entities. The projection queries create a query that selects from a set of entities in your model but returns results that are of a different type. This is also known as the query projection. The Projection Queries results can return an anonymous type or a Concrete type.

EF Core Projection Queries Read More »

EF Core Find Method

EF Core Find method finds a record with the given primary key values. If the entity is already in the context (because of a previous query), then the Find method returns it. The Find method sends the query to the database if it does not find it in the context.

EF Core Find Method Read More »

Single, SingleOrDefault, First, FirstOrDefault in EF Core

In this article let us look at the Single, SingleOrDefault, First, FirstOrDefault methods in EF Core. These methods return a single record from the database based on a Where condition. We use these methods when the Where condition is not part of the Primary Key, But we want only one record in the query result. If the Where condition is part of the primary key then use the find method.

Single, SingleOrDefault, First, FirstOrDefault in EF Core Read More »

Querying in Entity Framework Core

Querying in EF Core uses the LINQ to Entities. In this tutorial, we will learn how to use the Select clause to query to select all the rows. Use of ToList method to execute the query immediately and use the foreach loop to loop through the rows. How to filter using the Where clause. Sort the results using the OrderBy& ThenBy Clause. To sort in descending order using the orderByDescending & ThenByDescending methods. Also, look at how to sort on multiple fields, etc. You can write the EF Core query in two ways. One is Method Syntax & the other one is Query Syntax. In this tutorial, we will show you how to write EF Core Query using both the syntaxes

Querying in Entity Framework Core Read More »

Logging in EF Core

In this article let us find out how Logging in EF Core works. We use logging to Log SQL queries. Find out more about errors. Improve Performance of the SQL Queries etc. In the article, we will create an example application and show you how to log queries to console and also to the windows event log. We also show you how to filter the logs using the log levels & DbLogger Category.

Logging in EF Core Read More »

Scroll to Top