implement
This commit is contained in:
@@ -2,4 +2,7 @@ using AipsCore.Domain.Common.ValueObjects;
|
||||
|
||||
namespace AipsCore.Domain.Models.Shape.ValueObjects;
|
||||
|
||||
public record ShapeId(string Value) : DomainId(Value);
|
||||
public record ShapeId(string Value) : DomainId(Value)
|
||||
{
|
||||
public static ShapeId Any() => new ShapeId(Guid.NewGuid().ToString());
|
||||
}
|
||||
@@ -6,22 +6,23 @@ namespace AipsCore.Domain.Models.Shape.ValueObjects;
|
||||
|
||||
public record Thickness : AbstractValueObject
|
||||
{
|
||||
public int Value { get; }
|
||||
private const int MaxThickness = 8;
|
||||
private const int MinThickness = 1;
|
||||
|
||||
private readonly int _value;
|
||||
|
||||
public Thickness(int value)
|
||||
{
|
||||
_value = value;
|
||||
Value = value;
|
||||
Validate();
|
||||
}
|
||||
|
||||
protected override ICollection<IRule> GetValidationRules()
|
||||
{
|
||||
return
|
||||
[
|
||||
new MinValueRule<int>(_value, MinThickness),
|
||||
new MaxValueRule<int>(_value, MaxThickness),
|
||||
new MinValueRule<int>(Value, MinThickness),
|
||||
new MaxValueRule<int>(Value, MaxThickness),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user