Commit 22134c5c authored by Almouhannad's avatar Almouhannad

(B) Reafctor validation bases and add comments

parent a406f08e
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
public interface IValidationResult public interface IValidationResult
{ {
public static readonly Error ValidationError = new("ValidationError", "القيم المدخلة غير صالحة"); public static readonly Error ValidationError
= new("ValidationError", "القيم المدخلة غير صالحة");
#region Properties #region Properties
Error[] Errors { get; } Error[] Errors { get; }
#endregion #endregion
} }
...@@ -6,7 +6,13 @@ public class ValidationResult : Result, IValidationResult ...@@ -6,7 +6,13 @@ public class ValidationResult : Result, IValidationResult
: base(false, IValidationResult.ValidationError) => : base(false, IValidationResult.ValidationError) =>
Errors = errors; Errors = errors;
#region Properties
public Error[] Errors { get; } public Error[] Errors { get; }
#endregion
#region Static factory
public static ValidationResult WithErrors(Error[] errors) => new(errors); public static ValidationResult WithErrors(Error[] errors) => new(errors);
#endregion
} }
...@@ -6,7 +6,12 @@ public class ValidationResult<TValue> : Result<TValue>, IValidationResult ...@@ -6,7 +6,12 @@ public class ValidationResult<TValue> : Result<TValue>, IValidationResult
: base(default, false, IValidationResult.ValidationError) => : base(default, false, IValidationResult.ValidationError) =>
Errors = errors; Errors = errors;
#region Properties
public Error[] Errors { get; } public Error[] Errors { get; }
#endregion
#region Static factory
public static ValidationResult<TValue> WithErrors(Error[] errors) => new(errors); public static ValidationResult<TValue> WithErrors(Error[] errors) => new(errors);
#endregion
} }
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