Commit a406f08e authored by Almouhannad's avatar Almouhannad

(B) Add validation bases

parent a7ea84d5
namespace Domain.Shared.Validation;
public interface IValidationResult
{
public static readonly Error ValidationError = new("ValidationError", "القيم المدخلة غير صالحة");
#region Properties
Error[] Errors { get; }
#endregion
}
namespace Domain.Shared.Validation;
public class ValidationResult : Result, IValidationResult
{
private ValidationResult(Error[] errors)
: base(false, IValidationResult.ValidationError) =>
Errors = errors;
public Error[] Errors { get; }
public static ValidationResult WithErrors(Error[] errors) => new(errors);
}
namespace Domain.Shared.Validation;
public class ValidationResult<TValue> : Result<TValue>, IValidationResult
{
private ValidationResult(Error[] errors)
: base(default, false, IValidationResult.ValidationError) =>
Errors = errors;
public Error[] Errors { get; }
public static ValidationResult<TValue> WithErrors(Error[] errors) => new(errors);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment