Where is the best place to manage the automatic updating (unfortunately the database is off limits, no triggers )?
I'd have used the Validation framework, to set the non-FK field prior to save.
And this can be done once in one validator that's injected for any kind of entity.
Is there some way to make it even more automatic, like can LLBL generate the code to do that for me?
You can modify the templates to Synchronize the Name field at the same place the FK-PK synchronization takes place.
Both of the above 2 suggestions would highly depend on the naming convention of the Name field in the Primary Entity, and in The ForignKey-side Entity.
But this is going to be very tricky, say you have an EmailEntity, which has the following 2 FKs: FromUserId, and ToUserId, both refer to the User Entity.
Now if you have something like User.Name, and now you want to populate EmailEntity.FromUserName, and EmailEntity.ToUserName.
If at the code side, you have the Email.FromUser.Name, how would you relate it to Email.FromUserName field.
What I want to say is how the generic code will know that the Name of the related FromUserEntity, should be synchronized with the local FromUserName field.
Since no relation is ties them both.
Is there something I'm missing that would make my life even better still? (maybe reflection or something magical?)
Yes, the name field must be added to the PK fields (composite PK). And thus the synchronization would be generated into code for you.
If you can't modify the database schema, you can at least modify a dummy copy of it, upon which the entities should be mapped.
That's the fastest solution I can think of, to avoid any code manipulation.