From b00902e461ce16f27208f683dc5b3319140cccb0 Mon Sep 17 00:00:00 2001 From: TekH Date: Thu, 4 Dec 2025 14:42:00 +0100 Subject: [PATCH] Add one-to-one relationship between RecAction and OutRes Introduced a new `OutRes` navigation property in the `RecAction` class to establish a one-to-one relationship with the `OutRes` entity. Updated `RecDbContext` to configure this relationship using the Fluent API. The `OutRes` entity references its associated `RecAction` via the `Action` navigation property, with `ActionId` as the foreign key. --- src/ReC.Domain/Entities/RecAction.cs | 2 ++ src/ReC.Infrastructure/RecDbContext.cs | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/ReC.Domain/Entities/RecAction.cs b/src/ReC.Domain/Entities/RecAction.cs index fc92d1c..c2ebe24 100644 --- a/src/ReC.Domain/Entities/RecAction.cs +++ b/src/ReC.Domain/Entities/RecAction.cs @@ -69,4 +69,6 @@ public class RecAction [Column("CHANGED_WHEN")] public DateTime? ChangedWhen { get; set; } + + public OutRes? OutRes { get; set; } } \ No newline at end of file diff --git a/src/ReC.Infrastructure/RecDbContext.cs b/src/ReC.Infrastructure/RecDbContext.cs index 375a7f5..7f8094a 100644 --- a/src/ReC.Infrastructure/RecDbContext.cs +++ b/src/ReC.Infrastructure/RecDbContext.cs @@ -35,5 +35,10 @@ public class RecDbContext(DbContextOptions options) : DbContext(op modelBuilder.Entity().HasNoKey(); modelBuilder.Entity().HasNoKey(); + + modelBuilder.Entity() + .HasOne(act => act.OutRes) + .WithOne(res => res.Action) + .HasForeignKey(res => res.ActionId); } } \ No newline at end of file