Compare commits

...

4 Commits

Author SHA1 Message Date
87031d2a0a Add TODOs for middleware, generic service, and CQRS
Added TODO comments in Program.cs for exception handling middleware, and in CatalogService.cs and ICatalogService.cs for creating a generic service and implementing CQRS with MediatR. No functional changes made.
2026-01-16 13:34:23 +01:00
15680746b0 Refactor: add TODOs for generic repository pattern
Added TODO comments in ICatalogRepository and CatalogRepository to suggest adopting a generic repository pattern to reduce code duplication. Also noted the potential move of the interface to the application layer for better adherence to clean architecture principles.
2026-01-16 13:30:30 +01:00
cca6af814e Add TODO for configuring column names via appsettings
Added a TODO comment in ApplicationDbContext to suggest configuring column names using IConfiguration and appsettings. No functional changes were made.
2026-01-16 13:29:04 +01:00
fe9b211f59 Add SqlClient using and TODO for generic repository
Added Microsoft.Data.SqlClient using directive to CatalogRepository.cs. Also added a TODO comment suggesting the use of a generic repository pattern to minimize code duplication.
2026-01-16 13:28:11 +01:00
6 changed files with 9 additions and 0 deletions

View File

@@ -4,6 +4,8 @@ using DbFirst.Infrastructure;
using DbFirst.Infrastructure.Repositories;
using Microsoft.EntityFrameworkCore;
//TODO: create and add exception handling middleware
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.

View File

@@ -4,6 +4,8 @@ using DbFirst.Domain.Entities;
namespace DbFirst.Application.Catalogs;
//TODO: create generic service to reduce code duplication
//TODO: implement CQRS pattern with MediatR
public class CatalogService : ICatalogService
{
private readonly ICatalogRepository _repository;

View File

@@ -1,5 +1,6 @@
namespace DbFirst.Application.Catalogs;
//TODO: create generic service to reduce code duplication
public interface ICatalogService
{
Task<List<CatalogReadDto>> GetAllAsync(CancellationToken cancellationToken = default);

View File

@@ -2,6 +2,8 @@ using DbFirst.Domain.Entities;
namespace DbFirst.Domain.Repositories;
// TODO: instead of creating interface per entity, consider using generic repository pattern (eg. IRepository<T>) to reduce code duplication.
//TODO: move to application layer as a part of clean architecture
public interface ICatalogRepository
{
Task<List<VwmyCatalog>> GetAllAsync(CancellationToken cancellationToken = default);

View File

@@ -12,6 +12,7 @@ public partial class ApplicationDbContext : DbContext
public virtual DbSet<VwmyCatalog> VwmyCatalogs { get; set; }
// TODO: Configure column names on appsettings via IConfiguration
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<VwmyCatalog>(entity =>

View File

@@ -6,6 +6,7 @@ using System.Data;
namespace DbFirst.Infrastructure.Repositories;
// TODO: instead of creating implementation of repository per entity, consider using generic repository pattern (eg. Repository<T>) to reduce code duplication.
public class CatalogRepository : ICatalogRepository
{
private readonly ApplicationDbContext _db;