Introduction to Entity Framework Core

Welcome to the introductory documentation for Entity Framework Core (EF Core). EF Core is a modern object-relational mapper (ORM) for .NET that enables developers to work with a database using .NET objects. It eliminates the need for most of the data-access code that developers commonly need to write.

What is Entity Framework Core?

Entity Framework Core is an open-source, lightweight, extensible, and cross-platform version of the popular Entity Framework data access technology. It allows you to query a conceptual model described in terms of entities and properties from your database, and then, represent those entities and properties as objects in your code.

Key Features:

Why Use EF Core?

EF Core simplifies database interactions by providing an abstraction layer over the underlying data store. This offers several benefits:

Note: EF Core is the successor to the full .NET Framework Entity Framework 6 (EF6). While there are similarities, EF Core is a significant rewrite designed for modern .NET development.

Getting Started

To begin using EF Core, you typically need to:

  1. Install EF Core NuGet Packages: Add the necessary EF Core packages to your project (e.g., Microsoft.EntityFrameworkCore, Microsoft.EntityFrameworkCore.SqlServer, Microsoft.EntityFrameworkCore.Tools).
  2. Define Your Models: Create C# classes representing your database entities.
  3. Create a DbContext: This class acts as a session with the database and allows you to query and save data.
  4. Configure Your Database Provider: Specify which database you are connecting to (e.g., SQL Server, PostgreSQL, SQLite).

Refer to the Getting Started section for detailed instructions and code examples.