diff options
author | 杨宇千 <crupest@outlook.com> | 2019-10-23 20:41:19 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-10-23 20:41:19 +0800 |
commit | b67a26248d5dde4c3909c29b92b8a182248bdcc1 (patch) | |
tree | b005aa3d8bc34d8e710ce7fae30236c62dcbe712 /Timeline/Models/Validation | |
parent | 9c9762b4ecbd816be98ee0dd606fe15cc253b415 (diff) | |
download | timeline-b67a26248d5dde4c3909c29b92b8a182248bdcc1.tar.gz timeline-b67a26248d5dde4c3909c29b92b8a182248bdcc1.tar.bz2 timeline-b67a26248d5dde4c3909c29b92b8a182248bdcc1.zip |
...
Diffstat (limited to 'Timeline/Models/Validation')
-rw-r--r-- | Timeline/Models/Validation/UsernameValidator.cs | 14 | ||||
-rw-r--r-- | Timeline/Models/Validation/Validator.cs | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/Timeline/Models/Validation/UsernameValidator.cs b/Timeline/Models/Validation/UsernameValidator.cs index 65d4da71..dc237add 100644 --- a/Timeline/Models/Validation/UsernameValidator.cs +++ b/Timeline/Models/Validation/UsernameValidator.cs @@ -1,4 +1,5 @@ -using System.Linq;
+using System;
+using System.Linq;
namespace Timeline.Models.Validation
{
@@ -36,4 +37,15 @@ namespace Timeline.Models.Validation return (true, SuccessMessageGenerator);
}
}
+
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter,
+ AllowMultiple = false)]
+ public class UsernameAttribute : ValidateWithAttribute
+ {
+ public UsernameAttribute()
+ : base(typeof(UsernameValidator))
+ {
+
+ }
+ }
}
diff --git a/Timeline/Models/Validation/Validator.cs b/Timeline/Models/Validation/Validator.cs index 606ba7b4..d2c7c377 100644 --- a/Timeline/Models/Validation/Validator.cs +++ b/Timeline/Models/Validation/Validator.cs @@ -8,7 +8,7 @@ namespace Timeline.Models.Validation {
/// <summary>
/// Generate a message from a localizer factory.
- /// If localizerFactory is null, it should return a neutral-cultural message.
+ /// If localizerFactory is null, it should return a culture-invariant message.
/// </summary>
/// <param name="localizerFactory">The localizer factory. Could be null.</param>
/// <returns>The message.</returns>
|