I may be missing something here, but I can't get the following scenario to work:
I am storing Address entities in a separate table so that I can encapsulate business logic for addresses in the AddressEntity class.
The Client entity (simplified) looks like this:
Id
IdAddressPostal
IdAddressPhysical
with 1:1 relationships on the address fields to the address entity.
The Address entity does not have any references back to Client.
When I access the ClientEntity.AddressPostal property, an empty AddressEntity is returned (correctly, as no relevant Address entity exists yet).
If I set a property on this field (say ClientEntity.AddressPostal.City) to a value, then place a watch on the entity, then immediately access that property to see if it has worked, the returned value is "", i.e. it has not been set at all.
However, if the Address entity already exists in the database, everything works correctly.
I can obviously work around this by creating the address entries manually, but is there another way?