From 163b5bc2f91779f6cc47f4eb00057ebd0072692d Mon Sep 17 00:00:00 2001 From: TekH Date: Tue, 25 Nov 2025 14:15:06 +0100 Subject: [PATCH] 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. --- .../ReC.Infrastructure.csproj | 8 ++++++++ src/ReC.Infrastructure/RecDbContext.cs | 20 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/ReC.Infrastructure/RecDbContext.cs diff --git a/src/ReC.Infrastructure/ReC.Infrastructure.csproj b/src/ReC.Infrastructure/ReC.Infrastructure.csproj index fa71b7a..987f78b 100644 --- a/src/ReC.Infrastructure/ReC.Infrastructure.csproj +++ b/src/ReC.Infrastructure/ReC.Infrastructure.csproj @@ -6,4 +6,12 @@ enable + + + + + + + + diff --git a/src/ReC.Infrastructure/RecDbContext.cs b/src/ReC.Infrastructure/RecDbContext.cs new file mode 100644 index 0000000..2d62aec --- /dev/null +++ b/src/ReC.Infrastructure/RecDbContext.cs @@ -0,0 +1,20 @@ +using Microsoft.EntityFrameworkCore; +using ReC.Domain.Entities; + +namespace ReC.Infrastructure; + +public class RecDbContext(DbContextOptions options) : DbContext(options) +{ + public DbSet EndpointParams { get; set; } + + public DbSet Actions { get; set; } + + public DbSet OutRes { get; set; } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + + modelBuilder.Entity().HasNoKey(); + } +}