Add ProfileView entity mapped to VWREC_PROFILE view
Introduced the ProfileView entity as a record to represent data from the VWREC_PROFILE database view. Registered ProfileView in RecDbContext and configured its property mappings and primary key in OnModelCreating. This enables querying profile data via EF Core.
This commit is contained in:
40
src/ReC.Domain/Entities/ProfileView.cs
Normal file
40
src/ReC.Domain/Entities/ProfileView.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
namespace ReC.Domain.Entities;
|
||||
|
||||
public record ProfileView
|
||||
{
|
||||
public long ProfileGuid { get; init; }
|
||||
|
||||
public bool Active { get; init; }
|
||||
|
||||
public byte TypeId { get; init; }
|
||||
|
||||
public string Type { get; init; } = string.Empty;
|
||||
|
||||
public string Mandantor { get; init; } = string.Empty;
|
||||
|
||||
public string ProfileName { get; init; } = string.Empty;
|
||||
|
||||
public string? Description { get; init; }
|
||||
|
||||
public byte LogLevelId { get; init; }
|
||||
|
||||
public string LogLevel { get; init; } = string.Empty;
|
||||
|
||||
public short LanguageId { get; init; }
|
||||
|
||||
public string Language { get; init; } = string.Empty;
|
||||
|
||||
public string AddedWho { get; init; } = string.Empty;
|
||||
|
||||
public DateTime AddedWhen { get; init; }
|
||||
|
||||
public string? ChangedWho { get; init; }
|
||||
|
||||
public DateTime? ChangedWhen { get; init; }
|
||||
|
||||
public DateTime? FirstRun { get; init; }
|
||||
|
||||
public DateTime? LastRun { get; init; }
|
||||
|
||||
public string? LastResult { get; init; }
|
||||
}
|
||||
@@ -10,6 +10,8 @@ public class RecDbContext(DbContextOptions<RecDbContext> options) : DbContext(op
|
||||
|
||||
public DbSet<RecActionView> RecActionViews { get; set; }
|
||||
|
||||
public DbSet<ProfileView> ProfileViews { get; set; }
|
||||
|
||||
public DbSet<OutRes> OutRes { get; set; }
|
||||
|
||||
public DbSet<HeaderQueryResult> HeaderQueryResults { get; set; }
|
||||
@@ -163,6 +165,31 @@ public class RecDbContext(DbContextOptions<RecDbContext> options) : DbContext(op
|
||||
b.Property(e => e.ChangedWhen).HasColumnName("CHANGED_WHEN");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ProfileView>(b =>
|
||||
{
|
||||
b.ToView("VWREC_PROFILE", "dbo");
|
||||
b.HasKey(e => e.ProfileGuid);
|
||||
|
||||
b.Property(e => e.ProfileGuid).HasColumnName("PROFILE_GUID");
|
||||
b.Property(e => e.Active).HasColumnName("ACTIVE");
|
||||
b.Property(e => e.TypeId).HasColumnName("TYPE_ID");
|
||||
b.Property(e => e.Type).HasColumnName("TYPE");
|
||||
b.Property(e => e.Mandantor).HasColumnName("MANDANTOR");
|
||||
b.Property(e => e.ProfileName).HasColumnName("PROFILE_NAME");
|
||||
b.Property(e => e.Description).HasColumnName("DESCRIPTION");
|
||||
b.Property(e => e.LogLevelId).HasColumnName("LOG_LEVEL_ID");
|
||||
b.Property(e => e.LogLevel).HasColumnName("LOG_LEVEL");
|
||||
b.Property(e => e.LanguageId).HasColumnName("LANGUAGE_ID");
|
||||
b.Property(e => e.Language).HasColumnName("LANGUAGE");
|
||||
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.Property(e => e.FirstRun).HasColumnName("FIRST_RUN");
|
||||
b.Property(e => e.LastRun).HasColumnName("LAST_RUN");
|
||||
b.Property(e => e.LastResult).HasColumnName("LAST_RESULT");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<RecAction>(b =>
|
||||
{
|
||||
b.ToTable("TBREC_CFG_ACTION");
|
||||
|
||||
Reference in New Issue
Block a user