Value Object : VO shouldn't have a setter
DDD
Value Object should be immutable. Setter methods is a bad smell and a risk. Refactor your object to delete setter.
Value Objects are classes annotated with ValueObject
.
Examples
Example 1:
Negative
Incorrect implementation that violates the practice.
namespace Practices.DDD.ValueObject.HasSetter
{
[ValueObject]
public class ValueObject
{
public ValueObject()
{
}
public int SomeProperty { get; set; }
}
}