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:
@@ -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; }
|
||||
}
|
||||
@@ -24,4 +24,7 @@ public class ProfileObject
|
||||
|
||||
[Column("CMD_CheckIn")]
|
||||
public string? CmdCheckIn { get; set; }
|
||||
|
||||
[ForeignKey("ObjStateId")]
|
||||
public virtual ProfileObjState? State { get; set; }
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user