Guys,
If you can write code such as
purchaseOrder.CreatingUserId = user.UserId;
and
purchaseOrder.CreatingUser = user;
Which code is preferable or does it not matter?
I think if you have object references to hand I would prefer code which uses the object references to make it slightly clearer so the client doesn't have to read and understand the part of the entity which is the identifier.
However if you don't have the object reference and know the identifier then it would be more performant to simply set the identifier directly rather than have to retrieve an object reference to use just to set a property.
Thoughts?