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:
19
src/ReC.Application/Common/Interfaces/IRecDbContext.cs
Normal file
19
src/ReC.Application/Common/Interfaces/IRecDbContext.cs
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user