diff --git a/DotBased.AspNet.Authority/Managers/AuthorityUserManager.cs b/DotBased.AspNet.Authority/Managers/AuthorityUserManager.cs index cd31157..dd4bf6b 100755 --- a/DotBased.AspNet.Authority/Managers/AuthorityUserManager.cs +++ b/DotBased.AspNet.Authority/Managers/AuthorityUserManager.cs @@ -45,9 +45,7 @@ public partial class AuthorityManager var passwordValidation = await ValidatePasswordAsync(user, password); if (!passwordValidation.Success) { - List errors = []; - errors.AddRange(passwordValidation.Errors); - return AuthorityResult.Failed(errors, ResultFailReason.Validation); + return AuthorityResult.Failed(passwordValidation.Errors, ResultFailReason.Validation); } user.PasswordHash = await PasswordHasher.HashPasswordAsync(password); diff --git a/DotBased.AspNet.Authority/Models/AuthorityResult.cs b/DotBased.AspNet.Authority/Models/AuthorityResult.cs index 3cb3340..d74fcfa 100755 --- a/DotBased.AspNet.Authority/Models/AuthorityResult.cs +++ b/DotBased.AspNet.Authority/Models/AuthorityResult.cs @@ -11,7 +11,7 @@ public class AuthorityResult : Result Reason = ResultFailReason.Unknown; } - public AuthorityResult(bool success, string errorMessage = "", TResultValue? value = default, ResultFailReason reason = ResultFailReason.None, List? errors = null) : base(success, errorMessage, value, null) + public AuthorityResult(bool success, string errorMessage = "", TResultValue? value = default, ResultFailReason reason = ResultFailReason.None, IReadOnlyList? errors = null) : base(success, errorMessage, value, null) { Success = success; Message = errorMessage; @@ -20,7 +20,7 @@ public class AuthorityResult : Result ValidationErrors = errors; } public ResultFailReason Reason { get; } - public List? ValidationErrors { get; } + public IReadOnlyList? ValidationErrors { get; } public static AuthorityResult Ok(TResultValue? value) => new AuthorityResult(true, value:value); @@ -28,7 +28,7 @@ public class AuthorityResult : Result public static AuthorityResult Error(string errorMessage, ResultFailReason reason = ResultFailReason.Error) => new AuthorityResult(false, errorMessage, reason:reason); - public static AuthorityResult Failed(List errors, ResultFailReason reason = ResultFailReason.None) + public static AuthorityResult Failed(IReadOnlyList errors, ResultFailReason reason = ResultFailReason.None) => new AuthorityResult(false, errors:errors, reason:reason); }