Refactor ProfileObjState and ProfileObject relationships

Removed the State property from ProfileObjState and added
ChangedWho and ChangedWhen properties. Updated ProfileObject
to reference ProfileObjState instead of State. Modified
ProfileObjRepository to include the new State property
when querying ProfileObject instances.
This commit is contained in:
tekh 2025-08-01 02:21:48 +02:00
parent 1159f3f575
commit 7309b968fe
3 changed files with 4 additions and 3 deletions

View File

@ -83,7 +83,4 @@ public class ProfileObjState
[Column("CHANGED_WHEN", TypeName = "datetime")]
public DateTime? ChangedWhen { get; set; }
[ForeignKey("StateId")]
public virtual State? State { get; set; }
}

View File

@ -24,4 +24,7 @@ public class ProfileObject
[Column("CMD_CheckIn")]
public string? CmdCheckIn { get; set; }
[ForeignKey("ObjStateId")]
public virtual ProfileObjState? State { get; set; }
}

View File

@ -35,5 +35,6 @@ public class ProfileObjRepository : IProfileObjRepository
public async Task<IEnumerable<ProfileObject>> ReadAsync(int userId, int profileId, CancellationToken cancel = default)
=> await _context.Objects
.FromSqlRaw("SELECT * FROM [FNMWF_GET_PROFILE_OBJECTS] ({0}, {1})", userId, profileId)
.Include(obj => obj.State)
.ToListAsync(cancel);
}