Ivan
Ivan

Reputation: 1284

treat object as entity or value object?

Iam working on small booking room system. In my solution I have a Reservation (Entity) which holds reference to ReservationTerm (value object).

Reservation term is of 3 types - simple reservation term (which stands for simple from-to); period reservation term (which stands for period repetition); and composite term (which should aggregate forementioned terms);

And here is my problem. I dont know if i should treat ReservationTerm as object with identity or only value object. For me its importatnt to read values from it, but, i dont know how its gonna behave when I try to aggregate other ReservationTerms with CompositeTerm.

Upvotes: 0

Views: 211

Answers (1)

Oded
Oded

Reputation: 498904

Not only can a value object can hold another value object, it can hold entities.

In terms of how you model ReservationTerm - does it have an identity of its own or can it be fully described by its state? If the former, it should be an entity, if the latter, a value type.

Upvotes: 1

Related Questions