From 2bbfd96d624d6348f2dae307e2996c45e3e19bdd Mon Sep 17 00:00:00 2001 From: TekH Date: Thu, 27 Nov 2025 16:37:30 +0100 Subject: [PATCH] Add keyless query result entities for headers and bodies Added `HeaderQueryResult` and `BodyQueryResult` classes to represent query results for headers and bodies, respectively. These classes map their properties to database columns (`REQUEST_HEADER` and `REQUEST_BODY`) using the `[Column]` attribute. Both properties are nullable and immutable. Updated `RecDbContext` to configure these entities as keyless using the `HasNoKey()` method in the `OnModelCreating` method, indicating they are used for read-only queries. --- src/ReC.Domain/Entities/BodyQueryResult.cs.cs | 9 +++++++++ src/ReC.Domain/Entities/HeaderQueryResult.cs | 9 +++++++++ src/ReC.Infrastructure/RecDbContext.cs | 4 ++++ 3 files changed, 22 insertions(+) create mode 100644 src/ReC.Domain/Entities/BodyQueryResult.cs.cs create mode 100644 src/ReC.Domain/Entities/HeaderQueryResult.cs diff --git a/src/ReC.Domain/Entities/BodyQueryResult.cs.cs b/src/ReC.Domain/Entities/BodyQueryResult.cs.cs new file mode 100644 index 0000000..c464627 --- /dev/null +++ b/src/ReC.Domain/Entities/BodyQueryResult.cs.cs @@ -0,0 +1,9 @@ +using System.ComponentModel.DataAnnotations.Schema; + +namespace ReC.Domain.Entities; + +public class BodyQueryResult +{ + [Column("REQUEST_BODY")] + public string? RawBody { get; init; } +} diff --git a/src/ReC.Domain/Entities/HeaderQueryResult.cs b/src/ReC.Domain/Entities/HeaderQueryResult.cs new file mode 100644 index 0000000..6ed3830 --- /dev/null +++ b/src/ReC.Domain/Entities/HeaderQueryResult.cs @@ -0,0 +1,9 @@ +using System.ComponentModel.DataAnnotations.Schema; + +namespace ReC.Domain.Entities; + +public class HeaderQueryResult +{ + [Column("REQUEST_HEADER")] + public string? RawHeader { get; init; } +} diff --git a/src/ReC.Infrastructure/RecDbContext.cs b/src/ReC.Infrastructure/RecDbContext.cs index 7e91724..19a38c9 100644 --- a/src/ReC.Infrastructure/RecDbContext.cs +++ b/src/ReC.Infrastructure/RecDbContext.cs @@ -16,5 +16,9 @@ public class RecDbContext(DbContextOptions options) : DbContext(op base.OnModelCreating(modelBuilder); modelBuilder.Entity().HasNoKey(); + + modelBuilder.Entity().HasNoKey(); + + modelBuilder.Entity().HasNoKey(); } }