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:
parent
4f364e3eb2
commit
2bbfd96d62
9
src/ReC.Domain/Entities/BodyQueryResult.cs.cs
Normal file
9
src/ReC.Domain/Entities/BodyQueryResult.cs.cs
Normal 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; }
|
||||||
|
}
|
||||||
9
src/ReC.Domain/Entities/HeaderQueryResult.cs
Normal file
9
src/ReC.Domain/Entities/HeaderQueryResult.cs
Normal 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; }
|
||||||
|
}
|
||||||
@ -16,5 +16,9 @@ public class RecDbContext(DbContextOptions<RecDbContext> options) : DbContext(op
|
|||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|
||||||
modelBuilder.Entity<RecAction>().HasNoKey();
|
modelBuilder.Entity<RecAction>().HasNoKey();
|
||||||
|
|
||||||
|
modelBuilder.Entity<HeaderQueryResult>().HasNoKey();
|
||||||
|
|
||||||
|
modelBuilder.Entity<BodyQueryResult>().HasNoKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user