diff --git a/src/ReC.Domain/Entities/RecAction.cs b/src/ReC.Domain/Entities/RecAction.cs index c2ebe24..be6a8db 100644 --- a/src/ReC.Domain/Entities/RecAction.cs +++ b/src/ReC.Domain/Entities/RecAction.cs @@ -1,73 +1,47 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; +namespace ReC.Domain.Entities; -namespace ReC.Domain.Entities; - -[Table("TBREC_CFG_ACTION")] public class RecAction { - [Key] - [Column("GUID")] public long? Id { get; set; } - [Column("PROFILE_ID")] public long? ProfileId { get; set; } - [ForeignKey("ProfileId")] public Profile? Profile { get; set; } - [Column("ACTIVE")] public bool? Active { get; set; } - [Column("SEQUENCE")] public byte? Sequence { get; set; } - [Column("ENDPOINT_ID")] public long? EndpointId { get; set; } - [ForeignKey("EndpointId")] public Endpoint? Endpoint { get; set; } - [Column("ENDPOINT_AUTH_ID")] public long? EndpointAuthId { get; set; } - [ForeignKey("EndpointAuthId")] public EndpointAuth? EndpointAuth { get; set; } - [Column("ENDPOINT_PARAMS_ID")] public short? EndpointParamsId { get; set; } - [Column("SQL_CONNECTION_ID")] public short? SqlConnectionId { get; set; } - [ForeignKey("SqlConnectionId")] public Connection? SqlConnection { get; set; } - [Column("TYPE")] public string? Type { get; set; } - [Column("PREPROCESSING_QUERY")] public string? PreprocessingQuery { get; set; } - [Column("HEADER_QUERY")] public string? HeaderQuery { get; set; } - [Column("BODY_QUERY")] public string? BodyQuery { get; set; } - [Column("POSTPROCESSING_QUERY")] public string? PostprocessingQuery { get; set; } - [Column("ADDED_WHO")] public string? AddedWho { get; set; } - [Column("ADDED_WHEN")] public DateTime? AddedWhen { get; set; } - [Column("CHANGED_WHO")] public string? ChangedWho { get; set; } - [Column("CHANGED_WHEN")] public DateTime? ChangedWhen { get; set; } public OutRes? OutRes { get; set; } diff --git a/src/ReC.Infrastructure/RecDbContext.cs b/src/ReC.Infrastructure/RecDbContext.cs index 0af7808..5542ab6 100644 --- a/src/ReC.Infrastructure/RecDbContext.cs +++ b/src/ReC.Infrastructure/RecDbContext.cs @@ -162,6 +162,36 @@ public class RecDbContext(DbContextOptions options) : DbContext(op b.Property(e => e.ChangedWhen).HasColumnName("CHANGED_WHEN"); }); + modelBuilder.Entity(b => + { + b.ToTable("TBREC_CFG_ACTION"); + + b.HasKey(e => e.Id); + + b.Property(e => e.Id).HasColumnName("GUID"); + b.Property(e => e.ProfileId).HasColumnName("PROFILE_ID"); + b.Property(e => e.Active).HasColumnName("ACTIVE"); + b.Property(e => e.Sequence).HasColumnName("SEQUENCE"); + b.Property(e => e.EndpointId).HasColumnName("ENDPOINT_ID"); + b.Property(e => e.EndpointAuthId).HasColumnName("ENDPOINT_AUTH_ID"); + b.Property(e => e.EndpointParamsId).HasColumnName("ENDPOINT_PARAMS_ID"); + b.Property(e => e.SqlConnectionId).HasColumnName("SQL_CONNECTION_ID"); + b.Property(e => e.Type).HasColumnName("TYPE"); + b.Property(e => e.PreprocessingQuery).HasColumnName("PREPROCESSING_QUERY"); + b.Property(e => e.HeaderQuery).HasColumnName("HEADER_QUERY"); + b.Property(e => e.BodyQuery).HasColumnName("BODY_QUERY"); + b.Property(e => e.PostprocessingQuery).HasColumnName("POSTPROCESSING_QUERY"); + b.Property(e => e.AddedWho).HasColumnName("ADDED_WHO"); + b.Property(e => e.AddedWhen).HasColumnName("ADDED_WHEN"); + b.Property(e => e.ChangedWho).HasColumnName("CHANGED_WHO"); + b.Property(e => e.ChangedWhen).HasColumnName("CHANGED_WHEN"); + + b.HasOne(act => act.OutRes) + .WithOne(res => res.Action) + .HasForeignKey(res => res.ActionId) + .OnDelete(DeleteBehavior.Cascade); + }); + modelBuilder.Entity(b => { b.ToTable("VWREC_ACTION", "dbo"); @@ -209,10 +239,5 @@ public class RecDbContext(DbContextOptions options) : DbContext(op b.Property(e => e.RawBody).HasColumnName("REQUEST_BODY"); }); - modelBuilder.Entity() - .HasOne(act => act.OutRes) - .WithOne(res => res.Action) - .HasForeignKey(res => res.ActionId) - .OnDelete(DeleteBehavior.Cascade); } } \ No newline at end of file