Refactor DbContext and add IRecDbContext interface

Refactored `DependencyInjection` to use a generic `TRecDbContext`
for flexibility and added scoped registration for `IRecDbContext`.
Updated `RecDbContext` to implement the new `IRecDbContext`
interface, ensuring adherence to the application-layer contract.

Introduced the `IRecDbContext` interface in the application layer,
defining `DbSet` properties for key entities and a `SaveChangesAsync`
method. Updated `ReC.Infrastructure.csproj` to reference the
application project for interface access.
This commit is contained in:
2025-11-27 16:51:49 +01:00
parent 8ea7d47868
commit f8581deaf9
4 changed files with 26 additions and 2 deletions

View File

@@ -0,0 +1,19 @@
using Microsoft.EntityFrameworkCore;
using ReC.Domain.Entities;
namespace ReC.Application.Common.Interfaces;
public interface IRecDbContext
{
public DbSet<EndpointParam> EndpointParams { get; }
public DbSet<RecAction> Actions { get; }
public DbSet<OutRes> OutRes { get; }
public DbSet<HeaderQueryResult> HeaderQueryResults { get; }
public DbSet<BodyQueryResult> BodyQueryResults { get; }
public Task<int> SaveChangesAsync(CancellationToken cancel = default);
}