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.
This commit is contained in:
tekh 2025-11-27 16:37:30 +01:00
parent 4f364e3eb2
commit 2bbfd96d62
3 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,9 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace ReC.Domain.Entities;
public class BodyQueryResult
{
[Column("REQUEST_BODY")]
public string? RawBody { get; init; }
}

View File

@ -0,0 +1,9 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace ReC.Domain.Entities;
public class HeaderQueryResult
{
[Column("REQUEST_HEADER")]
public string? RawHeader { get; init; }
}

View File

@ -16,5 +16,9 @@ public class RecDbContext(DbContextOptions<RecDbContext> options) : DbContext(op
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<RecAction>().HasNoKey();
modelBuilder.Entity<HeaderQueryResult>().HasNoKey();
modelBuilder.Entity<BodyQueryResult>().HasNoKey();
}
}