Refactor Catalogs to use MediatR and CQRS pattern

Replaced direct service usage in CatalogsController with MediatR-based commands and queries for all CRUD operations. Added command/query and handler classes for Catalog operations. Updated dependency injection to register MediatR and removed ICatalogService. Improved code maintainability and testability by adopting CQRS architecture.
This commit is contained in:
OlgunR
2026-01-19 09:00:06 +01:00
parent c8c75b1dc5
commit 870b10779e
15 changed files with 185 additions and 11 deletions

View File

@@ -3,7 +3,7 @@ using DbFirst.Application.Catalogs;
using DbFirst.Domain.Repositories;
using DbFirst.Infrastructure;
using DbFirst.Infrastructure.Repositories;
using Microsoft.EntityFrameworkCore;
using MediatR;
using DbFirst.API.Middleware;
var builder = WebApplication.CreateBuilder(args);
@@ -38,7 +38,6 @@ builder.Services.AddInfrastructure(builder.Configuration);
builder.Services.AddApplication();
builder.Services.AddScoped<ICatalogRepository, CatalogRepository>();
builder.Services.AddScoped<ICatalogService, CatalogService>();
var app = builder.Build();