❔ A quick question
In this code i initialize a object.
UpdatedByUser = request.User.VacationApprovalManager,
UpdatedByUserId = request.User.VacationApprovalManager.Id,
I just want to know, do I need to use the first line of code or is the adding of the Id of the VacationApprovalManager enough for EntityFramework to figure out the updated user? basically do i need the first line of code ( UpdatedByUser = request.User.VacationApprovalManager)?
4 Replies
1. the id should be enough
2. couldn't you just test this?
also, it not really for EF to figure out the updated user.. when you store the id here, it's up to you to include the full user details (navigation property) when retrieving the history record if necessary
Yea yea i have to include it everytime use the DbContext to get the history record
If you set the
Foo
navigation property you don't need to set FooId
foreign key, and vice versa
Just one of them is enough
Assuming, of course, everytihing is set up properlyWas this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.