Introduction to Entity Framework Core

Learn about Entity Framework Core, its benefits, and what we’ll cover in the course.

Entity Framework Core (EF Core) is a modern, lightweight, open-source, and cross-platform version of Entity Framework. Entity Framework is an Object Relational Mapper (ORM) for .NET applications. It enables .NET developers to interact with relational databases through model objects.

EF Core persists model objects to and from a relational database. EF Core converts data between types that would otherwise be incompatible as a data-access technique. The illustration above shows EF Core mapping each row of an Employees table to an Employee object.

EF Core accesses many different databases through plug-in libraries called database providers. Some of these databases are:

  • SQL Server/Azure SQL Database
  • MySQL
  • SQLite
  • PostgreSQL
  • Cosmos DB

EF Core has support for all modern .NET implementations, such as the following:

  • .NET & .NET Core
  • .NET Framework (Version 4.7.2 provides support for EF Core 3.1)
  • Mono
  • Xamarin
  • UWP

Course topics

This course uses Entity Framework Core 6.0, which was released in November 2021. We’ll cover EF Core features as well as the workflows used for development. With these workflows, we’ll demonstrate how to connect to the database, fetch data, manage changes to the data, and save the data.

Who is this course for?

This course is for you if:

  • You are a .NET developer who wants to improve productivity and efficiency when interacting with relational databases.
  • You want to learn how to persist model objects to a relational database using EF Core.
  • You want to reduce the lines of data access code needed for your application to interact with a database.
  • You want to leverage the pretested, autogenerated code of EF Core when writing the data access code for your applications.

Benefits of the course

EF Core provides many benefits to developers, such as increasing productivity, requiring less code for data access, and providing connections to many data stores. It is an open-source library that is easy to use. It allows developers to perform CRUD operations on several data stores without writing different queries. Millions of applications use EF Core because it is stable, offers high performance, and can handle extreme workloads.

Prerequisites

This course has a lot of code examples written in C#. Some knowledge of SQL is beneficial due to the interaction with relational databases. Where necessary, SQLite is the database provider used in the code examples.

Configuration and installation of EF Core

EF Core is available as NuGet packages. There are two mediums for installation, as shown below:

  • Visual Studio: This program is an integrated development environment.
  • Command Line: The .NET Core command-line tools are cross platform and can run from within a command line environment from Windows, macOS or Linux operating systems. Learn how to install EF Core through the command line tools in the Appendix section of this course.

In this course, we’ll demonstrate concepts using the command line tools.