I’m using Entity.GetModifiedMembers() to log the updated values of the entities. But since there are lookup values, the modified members are seen as the related lookup Ids.
To make the view that the customers see from logging view as user friendly as possible, I’d like to get the updated properties “Name” value instead of the Id.
Example:
//Entities
public class User
{
Id { get; set; }
Name { get; set; }
FacultyId { get; set; }
}
public class UserFaculty
{
Id { get; set; }
Name { get; set; }
}
//Update Operation
public UpdateSomething
{
var user = GetUser();
user.FacultyId = SomeFacultyId;
//Log operation
Log(Entity.User.GetModifiedMembers());
Entity.SubmitChanges();
}
Log View:
Updated Entity | Updated Field | Original Value | New Value
User FacultyId 3 SomeFacultyId
Instead of the above view I’d like to have a view like below:
Updated Entity | Updated Field | Original Value | New Value
User FacultyId OldFacultyName SomeFacultyName
I’m open to suggestions. I’m not asking for the exact way to go after this point, If any point is not so optimal then I’d like to hear every aspect I’m going wrong.
You need to expose a method , inside your linq class which takes the SomeFacultyID as input and return FacultyName.