Move Endpoint entity config to Fluent API in DbContext
Removed data annotations from Endpoint class and defined its table, key, and column mappings using Fluent API in RecDbContext. This centralizes entity configuration and improves code maintainability.
This commit is contained in:
@@ -55,6 +55,25 @@ public class RecDbContext(DbContextOptions<RecDbContext> options) : DbContext(op
|
||||
b.Property(e => e.SysConnection).HasColumnName("SYS_CONNECTION");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Endpoint>(b =>
|
||||
{
|
||||
b.ToTable("TBREC_CFG_ENDPOINT");
|
||||
|
||||
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.Uri).HasColumnName("URI");
|
||||
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 =>
|
||||
{
|
||||
b.ToTable("TBREC_CFG_ENDPOINT_PARAMS", "dbo");
|
||||
|
||||
Reference in New Issue
Block a user