.NET Documentation

Microsoft Developer Network

Entity Framework Core

Entity Framework Core (EF Core) is a modern, cross-platform, extensible data access framework for .NET. It is a rewrite of the popular Entity Framework 6 (EF6) with significant improvements and architectural changes. EF Core is designed to be lightweight, high-performance, and flexible, allowing developers to interact with databases using object-oriented programming principles.

Key Features and Benefits

Core Concepts

Understanding these core concepts is crucial for effective use of EF Core:

Note: EF Core is the recommended data access technology for new .NET applications. While EF6 is still supported, EF Core offers significant advantages for modern development.

Getting Started

To start using EF Core, you'll typically need to install the appropriate NuGet packages. The core package is Microsoft.EntityFrameworkCore, and you'll need a provider package for your specific database.

For example, to use EF Core with SQL Server:


dotnet add package Microsoft.EntityFrameworkCore.SqlServer
dotnet add package Microsoft.EntityFrameworkCore.Tools
            

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

Relationship to ADO.NET

While EF Core abstracts away much of the complexity of ADO.NET, it still builds upon it. Under the hood, EF Core uses ADO.NET to execute commands against the database. However, EF Core provides a much higher level of abstraction, allowing developers to work with objects rather than raw SQL and data readers.

Important: For scenarios requiring fine-grained control or direct interaction with SQL, ADO.NET can still be used directly or in conjunction with EF Core.

Further Reading