Add EF Core and RecDbContext for database integration

Added the `Microsoft.EntityFrameworkCore` NuGet package to the
`ReC.Infrastructure` project to enable database functionality.
Introduced `RecDbContext` with `DbSet` properties for `EndpointParam`,
`Action`, and `OutRes` entities. Configured `Action` as a keyless
entity in `OnModelCreating`. Added a project reference to
`ReC.Domain` to use domain entities in the infrastructure layer.
This commit is contained in:
tekh 2025-11-25 14:15:06 +01:00
parent b94a620389
commit 163b5bc2f9
2 changed files with 28 additions and 0 deletions

View File

@ -6,4 +6,12 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.11" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ReC.Domain\ReC.Domain.csproj" />
</ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,20 @@
using Microsoft.EntityFrameworkCore;
using ReC.Domain.Entities;
namespace ReC.Infrastructure;
public class RecDbContext(DbContextOptions<RecDbContext> options) : DbContext(options)
{
public DbSet<EndpointParam> EndpointParams { get; set; }
public DbSet<Domain.Entities.Action> Actions { get; set; }
public DbSet<OutRes> OutRes { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Domain.Entities.Action>().HasNoKey();
}
}