-
Book Overview & Buying
-
Table Of Contents
Clean Architecture with .NET
By :
With repositories and mapping in place, the final step in this layer is to register SQL Server and wire it into the application's dependency injection (DI) setup.
All persistence-related registrations are centralized in the ServiceCollectionExtensions class within the Infrastructure project. If you haven't done so already, open this file and follow along as we walk through key pieces of the configuration.
At a high level, this setup brings together everything the Persistence layer needs to function at runtime. It registers SQL Server as the persistence provider, configures CoreDbContext using a factory-based lifetime, wires up repository implementations, and registers mapping profiles used to translate data between layers.
You can see this coordination reflected in how SQL Server and the repositories are registered together:
services.AddSqlServer()
.AddScoped<IProductRepository, ProductRepository>()
.AddScoped<IOrderRepository...