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.
This commit is contained in:
tekh 2025-12-04 14:42:00 +01:00
parent 74f4d06031
commit b00902e461
2 changed files with 7 additions and 0 deletions

View File

@ -69,4 +69,6 @@ public class RecAction
[Column("CHANGED_WHEN")]
public DateTime? ChangedWhen { get; set; }
public OutRes? OutRes { get; set; }
}

View File

@ -35,5 +35,10 @@ public class RecDbContext(DbContextOptions<RecDbContext> options) : DbContext(op
modelBuilder.Entity<HeaderQueryResult>().HasNoKey();
modelBuilder.Entity<BodyQueryResult>().HasNoKey();
modelBuilder.Entity<RecAction>()
.HasOne(act => act.OutRes)
.WithOne(res => res.Action)
.HasForeignKey<OutRes>(res => res.ActionId);
}
}