63 lines
1.7 KiB
C#
63 lines
1.7 KiB
C#
using System;
|
|
using NodePipeline.Abstractions.Validators;
|
|
|
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
|
|
|
namespace NodePipeline.Abstractions.Attributes.Validation.NodeField;
|
|
|
|
/// <summary>
|
|
/// Associated with <see cref="StringLengthValidator" />
|
|
/// </summary>
|
|
[AttributeUsage(AttributeTargets.Property)]
|
|
public sealed class HasLengthBetweenAttribute : Attribute
|
|
{
|
|
/// <summary>
|
|
/// Associated with <see cref="StringLengthValidator" />
|
|
/// </summary>
|
|
/// <param name="min">String min length non-inclusive</param>
|
|
/// <param name="max">String max length non-inclusive</param>
|
|
public HasLengthBetweenAttribute(int min, int max)
|
|
{
|
|
Min = min;
|
|
Max = max;
|
|
}
|
|
|
|
public int? Min { get; }
|
|
public int? Max { get; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Associated with <see cref="StringLengthValidator" />
|
|
/// </summary>
|
|
[AttributeUsage(AttributeTargets.Property)]
|
|
public sealed class HasMinLengthAttribute : Attribute
|
|
{
|
|
/// <summary>
|
|
/// Associated with <see cref="StringLengthValidator" />
|
|
/// </summary>
|
|
/// <param name="value">String min length non-inclusive</param>
|
|
public HasMinLengthAttribute(int value)
|
|
{
|
|
Value = value;
|
|
}
|
|
|
|
public int Value { get; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Associated with <see cref="StringLengthValidator" />
|
|
/// </summary>
|
|
[AttributeUsage(AttributeTargets.Property)]
|
|
public sealed class HasMaxLengthAttribute : Attribute
|
|
{
|
|
/// <summary>
|
|
/// Associated with <see cref="StringLengthValidator" />
|
|
/// </summary>
|
|
/// <param name="value">String max length non-inclusive</param>
|
|
public HasMaxLengthAttribute(int value)
|
|
{
|
|
Value = value;
|
|
}
|
|
|
|
public int Value { get; }
|
|
} |