You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Add NuGet metadata and icon files.
- Introduce CONTRIBUTING.md for contribution guidelines.
- Enhance documentation with badges and corrections.
- Update source code for extensibility and multi-version .NET support.
|`SGuardEmailAddressAttribute`| Email format |`string`|`[SGuardEmailAddress(typeof(Resources.SGuardDataAnnotations), "Email_InvalidFormat")]`|
93
-
|`SGuardPhoneAttribute`| Phone format |`string`|`[SGuardPhone(typeof(Resources.SGuardDataAnnotations), "Profile_Phone_Invalid")]`|
94
-
|`SGuardUrlAttribute`| URL format |`string`|`[SGuardUrl(typeof(Resources.SGuardDataAnnotations), "Common_Url_Invalid")]`|
95
-
|`SGuardCreditCardAttribute`| Credit card format |`string`|`[SGuardCreditCard(typeof(Resources.SGuardDataAnnotations), "Common_CreditCard_Invalid")]`|
96
-
|`SGuardRangeAttribute`| Value must be within a numeric range |`int`, `double`|`[SGuardRange(1, 10, typeof(Resources.SGuardDataAnnotations), "Common_Range")]`|
90
+
| Attribute | Purpose | Supported Types| Example Usage|
|`SGuardEmailAddressAttribute`| Email format |`string`|`[SGuardEmailAddress(typeof(Resources.SGuardDataAnnotations), "Email_InvalidFormat")]`|
98
+
|`SGuardPhoneAttribute`| Phone format |`string`|`[SGuardPhone(typeof(Resources.SGuardDataAnnotations), "Profile_Phone_Invalid")]`|
99
+
|`SGuardUrlAttribute`| URL format |`string`|`[SGuardUrl(typeof(Resources.SGuardDataAnnotations), "Common_Url_Invalid")]`|
100
+
|`SGuardCreditCardAttribute`| Credit card format |`string`|`[SGuardCreditCard(typeof(Resources.SGuardDataAnnotations), "Common_CreditCard_Invalid")]`|
101
+
|`SGuardRangeAttribute`| Value must be within a numeric range |`int`, `double`|`[SGuardRange(1, 10, typeof(Resources.SGuardDataAnnotations), "Common_Range")]`|
|`SGuardRequiredCollectionAttribute`| Collection must not be null/empty |`IEnumerable`, arrays, etc. |`[SGuardRequiredCollection(typeof(Resources.SGuardDataAnnotations), "Common_Collection_Required")]`|
103
-
|`SGuardMinCountAttribute`| Minimum item count in collection |`IEnumerable`, arrays, etc. |`[SGuardMinCount(2, typeof(Resources.SGuardDataAnnotations), "Common_Collection_MinCount")]`|
104
-
|`SGuardMaxCountAttribute`| Maximum item count in collection |`IEnumerable`, arrays, etc. |`[SGuardMaxCount(5, typeof(Resources.SGuardDataAnnotations), "Common_Collection_MaxCount")]`|
105
-
|`SGuardCollectionItemsMatchAttribute`| Each item must match one/more validators (e.g. regex, required) |`IEnumerable`, arrays, etc.|`[SGuardCollectionItemsMatch(typeof(EmailAddressAttribute), typeof(Resources.SGuardDataAnnotations), "Email_InvalidFormat", AggregateAllErrors = true)]`|
105
+
| Attribute | Purpose | Supported Types | Example Usage|
|`SGuardRequiredCollectionAttribute`| Collection must not be null/empty |`IEnumerable`, arrays, etc. |`[SGuardRequiredCollection(typeof(Resources.SGuardDataAnnotations), "Common_Collection_Required")]`|
108
+
|`SGuardMinCountAttribute`| Minimum item count in collection |`IEnumerable`, arrays, etc. |`[SGuardMinCount(2, typeof(Resources.SGuardDataAnnotations), "Common_Collection_MinCount")]`|
109
+
|`SGuardMaxCountAttribute`| Maximum item count in collection |`IEnumerable`, arrays, etc. |`[SGuardMaxCount(5, typeof(Resources.SGuardDataAnnotations), "Common_Collection_MaxCount")]`|
110
+
|`SGuardCollectionItemsMatchAttribute`| Each item must match one/more validators (e.g. regex, required) |`IEnumerable`, arrays, etc. |`[SGuardCollectionItemsMatch(typeof(EmailAddressAttribute), typeof(Resources.SGuardDataAnnotations), "Email_InvalidFormat", AggregateAllErrors = true)]`|
106
111
107
112
**Details:**
108
113
-`SGuardCollectionItemsMatchAttribute` can take multiple validators and will apply them to each item.
@@ -111,18 +116,18 @@ SGuard.DataAnnotations ships with built-in resource support for the following la
|`SGuardRequiredIfAttribute`| Field required if another property equals value | Any |`[SGuardRequiredIf("Country", "USA", typeof(Resources.SGuardDataAnnotations), "Address_Required")]`|
119
+
| Attribute | Purpose | Supported Types | Example Usage|
|`SGuardRequiredIfAttribute`| Field required if another property equals value | Any|`[SGuardRequiredIf("Country", "USA", typeof(Resources.SGuardDataAnnotations), "Address_Required")]`|
117
122
118
123
### Comparison Validators
119
124
120
-
| Attribute | Purpose | Supported Types| Example Usage|
|`SGuardCompareAttribute`| Values must be equal (like CompareAttribute) | Any |`[SGuardCompare("Password", typeof(Resources.SGuardDataAnnotations), "Password_Mismatch")]`|
123
-
|`SGuardBetweenAttribute`| Value must be between two properties | IComparable types |`[SGuardBetween("Min", "Max", true, typeof(Resources.SGuardDataAnnotations), "Common_Between")]`|
124
-
|`SGuardGreaterThanAttribute`| Value must be greater than another property | IComparable types |`[SGuardGreaterThan("MinAge", typeof(Resources.SGuardDataAnnotations), "Profile_BirthDate_MinimumAge")]`|
125
-
|`SGuardLessThanAttribute`| Value must be less than another property | IComparable types |`[SGuardLessThan("MaxAge", typeof(Resources.SGuardDataAnnotations), "Profile_BirthDate_MaximumAge")]`|
125
+
| Attribute | Purpose| Supported Types| Example Usage|
|`SGuardCompareAttribute`| Values must be equal (like CompareAttribute) | Any |`[SGuardCompare("Password", typeof(Resources.SGuardDataAnnotations), "Password_Mismatch")]`|
128
+
|`SGuardBetweenAttribute`| Value must be between two properties | IComparable types |`[SGuardBetween("Min", "Max", true, typeof(Resources.SGuardDataAnnotations), "Common_Between")]`|
129
+
|`SGuardGreaterThanAttribute`| Value must be greater than another property| IComparable types |`[SGuardGreaterThan("MinAge", typeof(Resources.SGuardDataAnnotations), "Profile_BirthDate_MinimumAge")]`|
130
+
|`SGuardLessThanAttribute`| Value must be less than another property | IComparable types |`[SGuardLessThan("MaxAge", typeof(Resources.SGuardDataAnnotations), "Profile_BirthDate_MaximumAge")]`|
126
131
127
132
**Supported types:**`int`, `double`, `decimal`, `DateTime`, `string`, etc. (anything implementing `IComparable`)
128
133
@@ -184,7 +189,7 @@ SGuard.DataAnnotations ships with built-in resource support for the following la
<Description>Advanced, extensible, and multilingual data validation and guard clause library for .NET. Includes custom validation attributes, guard helpers, and resource-based error messages for enterprise-grade applications.</Description>
0 commit comments