ExampleEntity: Office
{
officeId: Identifier,
countryCode: String
...
}
Lookup object: Country
Values (persisted in a table):
{ code: "AL", name: "Albania"},
{ code: "AG", name: "Antigua and Barbuda"},
...
In this example, the Office entity embeds a country code to describe it's location. Country feels like a value object, it is immutable object, it's a conceptual whole, it is completely replaceable. However value objects shouldn't have an identity, but I am using country code as its identity. What's the right way to think about this?
Other Examples
ExpenseItem embeds an expenseTypeCode
Task embeds a taskTypeCode