how to represent enums in DDD Aggregrate modeling

880 Views Asked by At

I am using Domain-driven-design for a project and as I am modeling the Aggregates I came across a scenario where one of its attributes has restricted input of only certain types. I know I would code this as an enum but aggregrate modeling is supposed to be above the implementation details.

How do I represent what would be an enum in the aggregate model ? This is my approach so far :

enter image description here

is this the correct way to represent this?

1

There are 1 best solutions below

0
Louis On

based on your class diagram you don't need an aggregate root. At least not yet. Without the Aggregate root, you'd have just an entity that's has a property color that's an enum.

If you feel like you need the aggregate root for whatever the reason, you would need to figure out where the UL places the enum property. Which entity (managed by the root) should own this value.