Refactor ObjectDto and update PObjectState relationships
Removed ObjStateId and Id from ObjectDto for simplification. Updated foreign key in PObjectState from ObjStateId to StateId, and modified TFControls to support nullable collections. Adjusted WFDBContext configuration for clearer foreign key relationships and improved maintainability of the database schema.
This commit is contained in:
@@ -47,10 +47,9 @@ public class WFDBContext : DbContext, IUserManagerDbContext
|
||||
modelBuilder.ConfigureUserManager();
|
||||
|
||||
modelBuilder.Entity<PObjectState>()
|
||||
.HasMany(pos => pos.TFControls)
|
||||
.HasMany(objState => objState.TFControls)
|
||||
.WithOne()
|
||||
.HasForeignKey(pctf => pctf.ObjStateId)
|
||||
.HasPrincipalKey(pos => pos.Id)
|
||||
.HasForeignKey(control => control.ObjStateId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
Reference in New Issue
Block a user