Refactor EndpointAuth EF mapping to Fluent API
Moved EF Core configuration for EndpointAuth from data annotations in the entity class to Fluent API in RecDbContext. This centralizes table, key, and property mappings, improving maintainability and consistency.
This commit is contained in:
@@ -3,56 +3,37 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
|
|
||||||
namespace ReC.Domain.Entities;
|
namespace ReC.Domain.Entities;
|
||||||
|
|
||||||
[Table("TBREC_CFG_ENDPOINT_AUTH")]
|
|
||||||
public class EndpointAuth
|
public class EndpointAuth
|
||||||
{
|
{
|
||||||
[Key]
|
|
||||||
[Column("GUID")]
|
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
||||||
public long? Id { get; set; }
|
public long? Id { get; set; }
|
||||||
|
|
||||||
[Column("ACTIVE")]
|
|
||||||
public bool? Active { get; set; }
|
public bool? Active { get; set; }
|
||||||
|
|
||||||
[Column("DESCRIPTION")]
|
|
||||||
public string? Description { get; set; }
|
public string? Description { get; set; }
|
||||||
|
|
||||||
[Column("TYPE")]
|
|
||||||
public string? Type { get; set; }
|
public string? Type { get; set; }
|
||||||
|
|
||||||
[Column("API_KEY")]
|
|
||||||
public string? ApiKey { get; set; }
|
public string? ApiKey { get; set; }
|
||||||
|
|
||||||
[Column("API_VALUE")]
|
|
||||||
public string? ApiValue { get; set; }
|
public string? ApiValue { get; set; }
|
||||||
|
|
||||||
[Column("API_KEY_ADD_TO")]
|
|
||||||
public string? ApiKeyAddTo { get; set; }
|
public string? ApiKeyAddTo { get; set; }
|
||||||
|
|
||||||
[Column("TOKEN")]
|
|
||||||
public string? Token { get; set; }
|
public string? Token { get; set; }
|
||||||
|
|
||||||
[Column("USERNAME")]
|
|
||||||
public string? Username { get; set; }
|
public string? Username { get; set; }
|
||||||
|
|
||||||
[Column("PASSWORD")]
|
|
||||||
public string? Password { get; set; }
|
public string? Password { get; set; }
|
||||||
|
|
||||||
[Column("DOMAIN")]
|
|
||||||
public string? Domain { get; set; }
|
public string? Domain { get; set; }
|
||||||
|
|
||||||
[Column("WORKSTATION")]
|
|
||||||
public string? Workstation { get; set; }
|
public string? Workstation { get; set; }
|
||||||
|
|
||||||
[Column("ADDED_WHO")]
|
|
||||||
public string? AddedWho { get; set; }
|
public string? AddedWho { get; set; }
|
||||||
|
|
||||||
[Column("ADDED_WHEN")]
|
|
||||||
public DateTime? AddedWhen { get; set; }
|
public DateTime? AddedWhen { get; set; }
|
||||||
|
|
||||||
[Column("CHANGED_WHO")]
|
|
||||||
public string? ChangedWho { get; set; }
|
public string? ChangedWho { get; set; }
|
||||||
|
|
||||||
[Column("CHANGED_WHEN")]
|
|
||||||
public DateTime? ChangedWhen { get; set; }
|
public DateTime? ChangedWhen { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,6 +74,33 @@ public class RecDbContext(DbContextOptions<RecDbContext> options) : DbContext(op
|
|||||||
b.Property(e => e.ChangedWhen).HasColumnName("CHANGED_WHEN");
|
b.Property(e => e.ChangedWhen).HasColumnName("CHANGED_WHEN");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<EndpointAuth>(b =>
|
||||||
|
{
|
||||||
|
b.ToTable("TBREC_CFG_ENDPOINT_AUTH");
|
||||||
|
|
||||||
|
b.HasKey(e => e.Id);
|
||||||
|
|
||||||
|
b.Property(e => e.Id)
|
||||||
|
.HasColumnName("GUID")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property(e => e.Active).HasColumnName("ACTIVE");
|
||||||
|
b.Property(e => e.Description).HasColumnName("DESCRIPTION");
|
||||||
|
b.Property(e => e.Type).HasColumnName("TYPE");
|
||||||
|
b.Property(e => e.ApiKey).HasColumnName("API_KEY");
|
||||||
|
b.Property(e => e.ApiValue).HasColumnName("API_VALUE");
|
||||||
|
b.Property(e => e.ApiKeyAddTo).HasColumnName("API_KEY_ADD_TO");
|
||||||
|
b.Property(e => e.Token).HasColumnName("TOKEN");
|
||||||
|
b.Property(e => e.Username).HasColumnName("USERNAME");
|
||||||
|
b.Property(e => e.Password).HasColumnName("PASSWORD");
|
||||||
|
b.Property(e => e.Domain).HasColumnName("DOMAIN");
|
||||||
|
b.Property(e => e.Workstation).HasColumnName("WORKSTATION");
|
||||||
|
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");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<EndpointParam>(b =>
|
modelBuilder.Entity<EndpointParam>(b =>
|
||||||
{
|
{
|
||||||
b.ToTable("TBREC_CFG_ENDPOINT_PARAMS", "dbo");
|
b.ToTable("TBREC_CFG_ENDPOINT_PARAMS", "dbo");
|
||||||
|
|||||||
Reference in New Issue
Block a user