Loading a Value object in List or DropdownList, DDD

前端 未结 4 784
春和景丽
春和景丽 2020-12-05 08:55

I need to clarify something.

Have Person Aggreagate , 2 VOs (Country, StateProvince).

I want to load all country in my presentation layer (i am using mvc)

4条回答
  •  时光说笑
    2020-12-05 09:34

    It sounds like countries are not in fact value objects here; they have distinct identities and are important for business purposes outside of your Person objects. They should become entities, and be treated in the fashion appropriate to them.

    Think of it this way: let's say some volatile country had their current dictator overthrown and got a name change. The Person object's reference to a Country should still be valid, because the Country is not defined by its attributes (i.e. the string denoting its name), but by its identity.

提交回复
热议问题