Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some enhancements and additions to DataAnnotations, incluiding implementation of a few missing pieces of Sys.ComponentModel.DataAnnotations v4.5, like: #740

Merged
merged 3 commits into from Aug 26, 2013

Conversation

pruiz
Copy link
Contributor

@pruiz pruiz commented Aug 25, 2013

Some enhancements and additions to DataAnnotations, incluiding implementation of a few missing pieces of Sys.ComponentModel.DataAnnotations v4.5, like:
- CompareAttribute
- CreditCardAttribute
- EmailAddressAttribute
- FileExtensionsAttribute
- PhoneAttribute
- Implemented IsValid() methods of Min/MaxLengthAttribute.
- Fixed all existing Validation attributes so they take into account current's locale when composing ErrorMessage.

This code is provided under MIT/X11 license.

…ented of a few missing pieces of Sys.ComponentModel.DataAnnotations v4.5, like:

	- CompareAttribute
	- CreditCardAttribute
	- EmailAddressAttribute
	- FileExtensionsAttribute
	- PhoneAttribute
	- Implemented  IsValid() methods of Min/MaxLengthAttribute.
	- Fixed all existing Validation attributes so they take into account current's locale when composing ErrorMessage.
@marek-safar
Copy link
Member

I am not sure what is the string.Format (CultureInfo.CurrentCulture change for.
Could you also use correct author for all your test files.

@pruiz
Copy link
Contributor Author

pruiz commented Aug 25, 2013

Hi Marek,

When using error messages from localized resources, AFAIK the way to call string.Format() is passing the current cuture as IFormatProvider so it formats parameters acording to the currently defined locale. This way the format string's arguments are formated as expected (i.e. a DateTime value would be formated on the expected format). This is the way I am used to work with string.Format() when possibly passing it localized strings, and thought it was the standar way on .Net. However, I will revert the change if that's not acceptable by mono. ;)

Regarding the test files, I just forgot about it. I will submit a fix right now.

@alexrp
Copy link
Contributor

alexrp commented Aug 25, 2013

By the way, for a change this large, you should state (in your pull request description) that the code is provided under the MIT/X11 license.

@pruiz
Copy link
Contributor Author

pruiz commented Aug 25, 2013

Ouch, I forgot about the MIT/X11 comment, I've just updated the pull-request description stating the license.

@marek-safar
Copy link
Member

DateTime or any other non-string value will be converted to string using ToString() operation which uses current-culture. Unless you need to overwrite this behaviour there is no need to pass CurrentCulture to string.Format

@pruiz
Copy link
Contributor Author

pruiz commented Aug 26, 2013

Hi Marek,

I've just reverted this change. ;)

marek-safar added a commit that referenced this pull request Aug 26, 2013
Some enhancements and additions to DataAnnotations, incluiding implementation of a few missing pieces of Sys.ComponentModel.DataAnnotations v4.5, like:
@marek-safar marek-safar merged commit 16013bc into mono:master Aug 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants