Let's definitely start with a quick overview of what
EF Core is before we get coding.
Entity Framework Core, or EF Core,
is an evolution of the .NET Data Access Framework,
which has been around since 2008 and evolving and
improving dramatically over the years.
EF Core is on the same release cadence as .NET itself, so EF Core 8
was released in November 2023 along with .NET 8. And I also want to
make sure you're aware of the fact that EF Core 8 is often referred
to just as EF 8, so you'll probably notice I go back and forth
throughout this course.
EF Core encompasses a set of .NET APIs for performing data
access in your software, and it is the official data
access platform for Microsoft.
It's used in millions of applications and it's cross‑platform.
You can build and run EF Core‑based APIs or applications on Windows,
macOS, and Linux, and even run them inside of Docker containers,
whether on‑premises or in the cloud. Object Relational Mappers,
or ORMs, are designed to reduce the friction between how data is
structured in a relational database and how you define your
classes. Without an ORM,
we typically have to write a lot of code to transform database results into
instances of the types in our software, but an ORM allows us to express our
queries using our classes, and then the ORM itself builds and executes the
relevant SQL for us, as well as materializing objects from the data that
come back from the database.
It also allows you to store and update and even delete data in the
database. Using an ORM can really eliminate a slew of redundant data
interaction coding tasks, and in doing so,
EF Core can really enhance developer productivity.
It also provides consistency in the tasks that it does rather
than having various members of your team invent their own means
of designing their data access.
While a typical ORM infers that the classes and database tables are of a
similar structure, EF Core has a mapping layer in between, and that gives
us a lot more flexibility in how to get from objects to tables and from
object properties to table columns, and EF Core allows you to connect to a
variety of data stores, most of them relational databases.
While Microsoft maintains rich providers for SQL Server and
SQLite, an in‑memory provider for very specialized testing
needs, and even one for Cosmos DB,
there are many other third‑party providers as well,
some commercial and some from the community.
Microsoft has even created a provider for Azure Cosmos DB,
Microsoft's document database in the cloud.
This allows you to leverage your existing knowledge of EF Core to
interact with Cosmos DB, instead of having to learn yet another client
API. If you're already familiar with EF Core, EF Core 8 is mostly
backwards compatible with the previous iteration.
The documentation always has a detailed list of breaking changes.
However, if you watch the earlier versions of my EF Core courses,
you'll find that this fundamentals course will address topics and features that are new to EF 8.