Add AuthorizedUser entity and DbSet to TaskFlowDbContext
A new `DbSet` property `AuthorizedUsers` was added to the `TaskFlowDbContext` class to represent keyless results for authorized users procedure results. The `OnModelCreating` method was updated to configure the `AuthorizedUser` entity as keyless, map it to a database view, and define the `WisagId` property mapping. Additionally, a new `AuthorizedUser` class was introduced in the `DigitalData.TaskFlow.Domain.ProcedureResults` namespace with an immutable `WisagId` property.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
namespace DigitalData.TaskFlow.Domain.ProcedureResults;
|
||||
|
||||
public class AuthorizedUser
|
||||
{
|
||||
public int WisagId { get; init; }
|
||||
}
|
||||
@@ -23,6 +23,11 @@ public sealed class TaskFlowDbContext(DbContextOptions<TaskFlowDbContext> option
|
||||
/// </summary>
|
||||
public DbSet<WorkflowClosing> WorkflowClosings => Set<WorkflowClosing>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the keyless result model used for authorized users procedure results.
|
||||
/// </summary>
|
||||
public DbSet<AuthorizedUser> AuthorizedUsers => Set<AuthorizedUser>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
@@ -50,5 +55,12 @@ public sealed class TaskFlowDbContext(DbContextOptions<TaskFlowDbContext> option
|
||||
entity.Property(x => x.Code).HasColumnName("CODE").HasColumnType("int");
|
||||
entity.Property(x => x.Result).HasColumnName("RESULT").HasColumnType("nvarchar(400)");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AuthorizedUser>(entity =>
|
||||
{
|
||||
entity.HasNoKey();
|
||||
entity.ToView(null);
|
||||
entity.Property(x => x.WisagId).HasColumnName("wisagid").HasColumnType("int");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user