Intent.ValueObjects
This module provides a simple Value Object implementation in C# based on the Microsoft suggested pattern.
What is a ValueObject
More information can be found on the official Microsoft documentation website, but in summary:
- Value Objects do not have an identity – they are defined solely by their attributes.
- They are immutable – once created, their state cannot be changed.
What's in this module?
- Microsoft suggested pattern implementation.
Domain Designer
extensions that enable modelingValueObjects
in theDomain Designer
.
Modelling ValueObjects
Once this module is installed, the New Value Object menu item will be available, allowing Value Objects to be added in the Domain Designer.
ValueObjects
are modelled in a similar fashion to Entities
.
ValueObjects and Primary Keys
Note
Value Objects should not be modeled with a primary key
.
Unlike Entities
, which have a unique identifier, Value Objects
are defined by their attributes rather than an identity. If two Value Objects have the same data, they are considered equal. Therefore, assigning a primary key would contradict their purpose and introduce unnecessary complexity. Instead, Value Objects are typically embedded within Entities rather than stored as separate database records.