Let's definitely start with a quick overview of what
EF Core 6 is before we get coding.
Entity Framework Core, or EF Core,
is an evolution of Microsoft's object relational mapper,
which has been around since 2008 and evolving and
improving dramatically over the years.
EF Core encompasses a set of .NET APIs for
performing data access in your software,
and it is the official data access platform from 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 datastores,
most of them relational databases. While Microsoft maintains rich
providers for SQL Server and SQLite, and even an in‑memory provider
that's great for some of your automated testing scenarios, 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 5,
EF Core 6 is mostly backwards compatible.
However,
if you've watched the earlier EF Core Getting Started course for EF Core 5,
you'll find that this new EF Core 6 Fundamentals course will
address topics and features that haven't been included in my past Getting Started courses.