In this section, we will explore how to build a data access layer using the repository pattern and EF Core. The repository pattern is an additional abstraction over our data source. It provides reading and writing operations on data.
Implementing a data access layer using EF Core
Defining the repository pattern and unit of work
Before we start, we need to define some interfaces in the Catalog.Domain project. Let's proceed by setting a generic interface to determine the unit of work of our repository:
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Catalog.Domain.Repositories
{
public interface IUnitOfWork : IDisposable
{
Task<int> SaveChangesAsync(CancellationToken cancellationToken...