Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2014-11-24 22:34:18 +0300
committerMarek Safar <marek.safar@gmail.com>2014-11-24 22:34:18 +0300
commitc7405e6ca0b5749433c9c7acd49a5a8521ed9094 (patch)
tree2002e30dc3eb4b67d34bb1d063bf8fac2626fc2b /mcs/class/System.ComponentModel.DataAnnotations
parent10077506080e145cdabc25a393e5b3f7bf6e101e (diff)
[System.ComponentModel.DataAnnotations] Replace with .net implementation
Diffstat (limited to 'mcs/class/System.ComponentModel.DataAnnotations')
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/DataAnnotationsResources.cs59
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/ColumnAttribute.cs55
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/ComplexTypeAttribute.cs41
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/DatabaseGeneratedAttribute.cs47
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/DatabaseGeneratedOption.cs41
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/ForeignKeyAttribute.cs47
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/InversePropertyAttribute.cs47
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/NotMappedAttribute.cs41
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/TableAttribute.cs49
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.dll.sources75
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/AssociatedMetadataTypePropertyDescriptor.cs69
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/AssociatedMetadataTypeTypeDescriptionProvider.cs66
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/AssociatedMetadataTypeTypeDescriptor.cs170
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/AssociationAttribute.cs89
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ChangeLog64
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/CompareAttribute.cs118
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ConcurrencyCheckAttribute.cs44
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ControlParameters.cs92
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/CreditCardAttribute.cs75
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/CustomValidationAttribute.cs141
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DataType.cs57
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DataTypeAttribute.cs109
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DisplayAttribute.cs160
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DisplayColumnAttribute.cs59
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DisplayFormatAttribute.cs46
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/EditableAttribute.cs48
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/EmailAddressAttribute.cs313
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/EnumDataTypeAttribute.cs117
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/FileExtensionsAttribute.cs92
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/FilterUIHintAttribute.cs93
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/IValidatableObject.cs41
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/KeyAttribute.cs39
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/MaxLengthAttribute.cs91
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/MetadataTypeAttribute.cs45
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/MinLengthAttribute.cs82
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/PhoneAttribute.cs69
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/RangeAttribute.cs191
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/RegularExpressionAttribute.cs78
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/RequiredAttribute.cs62
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ScaffoldColumnAttribute.cs46
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ScaffoldTableAttribute.cs46
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/StringLengthAttribute.cs99
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/TimestampAttribute.cs43
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/UIHintAttribute.cs94
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/UrlAttribute.cs52
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationAttribute.cs270
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationAttributeCollectionExtensions.cs81
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationContext.cs160
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationException.cs84
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationResult.cs72
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/Validator.cs206
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CreditCardAttributeTest.cs4
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/DisplayAttributeTest.cs2
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/EmailAddressAttributeTest.cs11
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/RegularExpressionAttributeTest.cs33
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/mobile_System.ComponentModel.DataAnnotations.dll.sources1
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/mobile_static_System.ComponentModel.DataAnnotations.dll.sources1
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/monodroid_System.ComponentModel.DataAnnotations.dll.sources1
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/monotouch_System.ComponentModel.DataAnnotations.dll.sources1
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/net_4_0_System.ComponentModel.DataAnnotations.dll.sources9
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/net_4_5_System.ComponentModel.DataAnnotations.dll.sources17
-rw-r--r--mcs/class/System.ComponentModel.DataAnnotations/xammac_System.ComponentModel.DataAnnotations.dll.sources1
62 files changed, 134 insertions, 4422 deletions
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/DataAnnotationsResources.cs b/mcs/class/System.ComponentModel.DataAnnotations/DataAnnotationsResources.cs
new file mode 100644
index 00000000000..5ff50e119df
--- /dev/null
+++ b/mcs/class/System.ComponentModel.DataAnnotations/DataAnnotationsResources.cs
@@ -0,0 +1,59 @@
+namespace System.ComponentModel.DataAnnotations.Resources
+{
+static class DataAnnotationsResources
+{
+ public const string ArgumentIsNullOrWhitespace = "ArgumentIsNullOrWhitespace";
+ public const string AssociatedMetadataTypeTypeDescriptor_MetadataTypeContainsUnknownProperties = "AssociatedMetadataTypeTypeDescriptor_MetadataTypeContainsUnknownProperties";
+ public const string AttributeStore_Unknown_Property = "AttributeStore_Unknown_Property";
+ public const string Common_PropertyNotFound = "Common_PropertyNotFound";
+ public const string CompareAttribute_MustMatch = "CompareAttribute_MustMatch";
+ public const string CompareAttribute_UnknownProperty = "CompareAttribute_UnknownProperty";
+ public const string CreditCardAttribute_Invalid = "CreditCardAttribute_Invalid";
+ public const string CustomValidationAttribute_Method_Must_Return_ValidationResult = "CustomValidationAttribute_Method_Must_Return_ValidationResult";
+ public const string CustomValidationAttribute_Method_Not_Found = "CustomValidationAttribute_Method_Not_Found";
+ public const string CustomValidationAttribute_Method_Required = "CustomValidationAttribute_Method_Required";
+ public const string CustomValidationAttribute_Method_Signature = "CustomValidationAttribute_Method_Signature";
+ public const string CustomValidationAttribute_Type_Conversion_Failed = "CustomValidationAttribute_Type_Conversion_Failed";
+ public const string CustomValidationAttribute_Type_Must_Be_Public = "CustomValidationAttribute_Type_Must_Be_Public";
+ public const string CustomValidationAttribute_ValidationError = "{0} is not valid.";
+ public const string CustomValidationAttribute_ValidatorType_Required = "CustomValidationAttribute_ValidatorType_Required";
+ public const string DataTypeAttribute_EmptyDataTypeString = "DataTypeAttribute_EmptyDataTypeString";
+ public const string DisplayAttribute_PropertyNotSet = "The {0} property has not been set. Use the {1} method to get the value.";
+ public const string EmailAddressAttribute_Invalid = "EmailAddressAttribute_Invalid";
+ public const string EnumDataTypeAttribute_TypeCannotBeNull = "EnumDataTypeAttribute_TypeCannotBeNull";
+ public const string EnumDataTypeAttribute_TypeNeedsToBeAnEnum = "EnumDataTypeAttribute_TypeNeedsToBeAnEnum";
+ public const string FileExtensionsAttribute_Invalid = "FileExtensionsAttribute_Invalid";
+ public const string LocalizableString_LocalizationFailed = "Cannot retrieve property '{0}' because localization failed. Type '{1}' is not public or does not contain a public static string property with the name '{2}'.";
+ public const string MaxLengthAttribute_InvalidMaxLength = "MaxLengthAttribute_InvalidMaxLength";
+ public const string MaxLengthAttribute_ValidationError = "MaxLengthAttribute_ValidationError";
+ public const string MetadataTypeAttribute_TypeCannotBeNull = "MetadataTypeAttribute_TypeCannotBeNull";
+ public const string MinLengthAttribute_InvalidMinLength = "MinLengthAttribute_InvalidMinLength";
+ public const string MinLengthAttribute_ValidationError = "MinLengthAttribute_ValidationError";
+ public const string PhoneAttribute_Invalid = "PhoneAttribute_Invalid";
+ public const string RangeAttribute_ArbitraryTypeNotIComparable = "RangeAttribute_ArbitraryTypeNotIComparable";
+ public const string RangeAttribute_MinGreaterThanMax = "RangeAttribute_MinGreaterThanMax";
+ public const string RangeAttribute_Must_Set_Min_And_Max = "RangeAttribute_Must_Set_Min_And_Max";
+ public const string RangeAttribute_Must_Set_Operand_Type = "RangeAttribute_Must_Set_Operand_Type";
+ public const string RangeAttribute_ValidationError = "The field {0} must be between {1} and {2}.";
+ public const string RegexAttribute_ValidationError = "The field {0} must match the regular expression {1}.";
+ public const string RegularExpressionAttribute_Empty_Pattern = "The pattern must be set to a valid regular expression.";
+ public const string RequiredAttribute_ValidationError = "RequiredAttribute_ValidationError";
+ public const string StringLengthAttribute_InvalidMaxLength = "StringLengthAttribute_InvalidMaxLength";
+ public const string StringLengthAttribute_ValidationError = "The field {0} must be a string with a maximum length of {1}.";
+ public const string StringLengthAttribute_ValidationErrorIncludingMinimum = "StringLengthAttribute_ValidationErrorIncludingMinimum";
+ public const string UIHintImplementation_ControlParameterKeyIsNotAString = "UIHintImplementation_ControlParameterKeyIsNotAString";
+ public const string UIHintImplementation_ControlParameterKeyIsNull = "UIHintImplementation_ControlParameterKeyIsNull";
+ public const string UIHintImplementation_ControlParameterKeyOccursMoreThanOnce = "UIHintImplementation_ControlParameterKeyOccursMoreThanOnce";
+ public const string UIHintImplementation_NeedEvenNumberOfControlParameters = "UIHintImplementation_NeedEvenNumberOfControlParameters";
+ public const string UrlAttribute_Invalid = "UrlAttribute_Invalid";
+ public const string ValidationAttribute_Cannot_Set_ErrorMessage_And_Resource = "ValidationAttribute_Cannot_Set_ErrorMessage_And_Resource";
+ public const string ValidationAttribute_IsValid_NotImplemented = "ValidationAttribute_IsValid_NotImplemented";
+ public const string ValidationAttribute_NeedBothResourceTypeAndResourceName = "ValidationAttribute_NeedBothResourceTypeAndResourceName";
+ public const string ValidationAttribute_ResourcePropertyNotStringType = "ValidationAttribute_ResourcePropertyNotStringType";
+ public const string ValidationAttribute_ResourceTypeDoesNotHaveProperty = "ValidationAttribute_ResourceTypeDoesNotHaveProperty";
+ public const string ValidationAttribute_ValidationError = "The field {0} is invalid.";
+ public const string ValidationContextServiceContainer_ItemAlreadyExists = "ValidationContextServiceContainer_ItemAlreadyExists";
+ public const string Validator_InstanceMustMatchValidationContextInstance = "Validator_InstanceMustMatchValidationContextInstance";
+ public const string Validator_Property_Value_Wrong_Type = "Validator_Property_Value_Wrong_Type";
+}
+} \ No newline at end of file
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/ColumnAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/ColumnAttribute.cs
deleted file mode 100644
index c015d65f165..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/ColumnAttribute.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// ColumnAttribute.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-//
-// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_5
-
-using System;
-
-namespace System.ComponentModel.DataAnnotations.Schema
-{
- [AttributeUsageAttribute (AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
- public class ColumnAttribute : Attribute
- {
- public ColumnAttribute ()
- {
- }
-
- public ColumnAttribute (string name)
- {
- Name = name;
- }
-
- public string Name { get; private set; }
-
- public int Order { get; set; }
-
- public string TypeName { get; set; }
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/ComplexTypeAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/ComplexTypeAttribute.cs
deleted file mode 100644
index a3796e01b2e..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/ComplexTypeAttribute.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// ComplexTypeAttribute.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-//
-// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_5
-
-using System;
-
-namespace System.ComponentModel.DataAnnotations.Schema
-{
- [AttributeUsageAttribute (AttributeTargets.Class, AllowMultiple = false)]
- public class ComplexTypeAttribute : Attribute
- {
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/DatabaseGeneratedAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/DatabaseGeneratedAttribute.cs
deleted file mode 100644
index ad3cdab1f5a..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/DatabaseGeneratedAttribute.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// DatabaseGeneratedAttribute.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-//
-// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_5
-
-using System;
-
-namespace System.ComponentModel.DataAnnotations.Schema
-{
- [AttributeUsageAttribute (AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
- public class DatabaseGeneratedAttribute : Attribute
- {
- public DatabaseGeneratedAttribute (DatabaseGeneratedOption databaseGeneratedOption)
- {
- DatabaseGeneratedOption = databaseGeneratedOption;
- }
-
- public DatabaseGeneratedOption DatabaseGeneratedOption { get; private set; }
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/DatabaseGeneratedOption.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/DatabaseGeneratedOption.cs
deleted file mode 100644
index 051c606d5ae..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/DatabaseGeneratedOption.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// DatabaseGeneratedOption.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-//
-// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_5
-
-namespace System.ComponentModel.DataAnnotations.Schema
-{
- public enum DatabaseGeneratedOption
- {
- None,
- Identity,
- Computed
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/ForeignKeyAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/ForeignKeyAttribute.cs
deleted file mode 100644
index 9a3d0083bb4..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/ForeignKeyAttribute.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// ForeignKeyAttribute.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-//
-// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_5
-
-using System;
-
-namespace System.ComponentModel.DataAnnotations.Schema
-{
- [AttributeUsageAttribute (AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
- public class ForeignKeyAttribute : Attribute
- {
- public ForeignKeyAttribute (string name)
- {
- Name = name;
- }
-
- public string Name { get; private set; }
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/InversePropertyAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/InversePropertyAttribute.cs
deleted file mode 100644
index 155a3b900fa..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/InversePropertyAttribute.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// InversePropertyAttribute.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-//
-// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_5
-
-using System;
-
-namespace System.ComponentModel.DataAnnotations.Schema
-{
- [AttributeUsageAttribute (AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
- public class InversePropertyAttribute : Attribute
- {
- public InversePropertyAttribute (string property)
- {
- Property = property;
- }
-
- public string Property { get; private set; }
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/NotMappedAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/NotMappedAttribute.cs
deleted file mode 100644
index 5d66ccc4152..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/NotMappedAttribute.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// NotMappedAttribute.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-//
-// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_5
-
-using System;
-
-namespace System.ComponentModel.DataAnnotations.Schema
-{
- [AttributeUsageAttribute (AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
- public class NotMappedAttribute : Attribute
- {
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/TableAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/TableAttribute.cs
deleted file mode 100644
index 65f7912a004..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.Schema/TableAttribute.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// TableAttribute.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-//
-// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_5
-
-using System;
-
-namespace System.ComponentModel.DataAnnotations.Schema
-{
- [AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = false)]
- public class TableAttribute : Attribute
- {
- public TableAttribute (string name)
- {
- Name = name;
- }
-
- public string Name { get; private set; }
-
- public string Schema { get; set; }
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.dll.sources b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.dll.sources
index 7fdb746ad04..df43b5ed4b0 100644
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.dll.sources
+++ b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.dll.sources
@@ -2,29 +2,52 @@
../../build/common/Locale.cs
../../build/common/MonoTODOAttribute.cs
Assembly/AssemblyInfo.cs
-System.ComponentModel.DataAnnotations/AssociatedMetadataTypePropertyDescriptor.cs
-System.ComponentModel.DataAnnotations/AssociatedMetadataTypeTypeDescriptor.cs
-System.ComponentModel.DataAnnotations/AssociatedMetadataTypeTypeDescriptionProvider.cs
-System.ComponentModel.DataAnnotations/AssociationAttribute.cs
-System.ComponentModel.DataAnnotations/ControlParameters.cs
-System.ComponentModel.DataAnnotations/ConcurrencyCheckAttribute.cs
-System.ComponentModel.DataAnnotations/CustomValidationAttribute.cs
-System.ComponentModel.DataAnnotations/DataType.cs
-System.ComponentModel.DataAnnotations/DataTypeAttribute.cs
-System.ComponentModel.DataAnnotations/DisplayAttribute.cs
-System.ComponentModel.DataAnnotations/DisplayColumnAttribute.cs
-System.ComponentModel.DataAnnotations/DisplayFormatAttribute.cs
-System.ComponentModel.DataAnnotations/EditableAttribute.cs
-System.ComponentModel.DataAnnotations/EnumDataTypeAttribute.cs
-System.ComponentModel.DataAnnotations/IValidatableObject.cs
-System.ComponentModel.DataAnnotations/MetadataTypeAttribute.cs
-System.ComponentModel.DataAnnotations/RangeAttribute.cs
-System.ComponentModel.DataAnnotations/RegularExpressionAttribute.cs
-System.ComponentModel.DataAnnotations/RequiredAttribute.cs
-System.ComponentModel.DataAnnotations/ScaffoldColumnAttribute.cs
-System.ComponentModel.DataAnnotations/ScaffoldTableAttribute.cs
-System.ComponentModel.DataAnnotations/StringLengthAttribute.cs
-System.ComponentModel.DataAnnotations/UIHintAttribute.cs
-System.ComponentModel.DataAnnotations/UrlAttribute.cs
-System.ComponentModel.DataAnnotations/ValidationAttribute.cs
-System.ComponentModel.DataAnnotations/ValidationException.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/AssociatedMetadataTypeTypeDescriptionProvider.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/AssociatedMetadataTypeTypeDescriptor.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/AssociationAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/BindableTypeAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/CompareAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/ConcurrencyCheckAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/CreditCardAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/CustomValidationAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/DataType.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/DataTypeAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/DisplayAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/DisplayColumnAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/DisplayFormatAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/EditableAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/EmailAddressAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/EnumDataTypeAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/FileExtensionsAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/FilterUIHintAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/IValidatableObject.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/KeyAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/LocalizableString.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/MaxLengthAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/MetadataPropertyDescriptorWrapper.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/MetadataTypeAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/MinLengthAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/PhoneAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/RangeAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/RegularExpressionAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/RequiredAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/ScaffoldAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/Schema/ColumnAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/Schema/ComplexTypeAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/Schema/DatabaseGeneratedAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/Schema/DatabaseGeneratedOption.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/Schema/ForeignKeyAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/Schema/InversePropertyAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/Schema/NotMappedAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/Schema/TableAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/StringLengthAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/TimestampAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/UIHintAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/UrlAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/ValidationAttribute.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/ValidationAttributeStore.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/ValidationContext.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/ValidationException.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/ValidationResult.cs
+../../../external/referencesource/System.ComponentModel.DataAnnotations/DataAnnotations/Validator.cs
+DataAnnotationsResources.cs
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/AssociatedMetadataTypePropertyDescriptor.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/AssociatedMetadataTypePropertyDescriptor.cs
deleted file mode 100644
index 2c1b013d3cd..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/AssociatedMetadataTypePropertyDescriptor.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-//
-// AssociatedMetadataTypeTypeDescriptionProvider.cs
-//
-// Author:
-// Marek Habersack <mhabersack@novell.com>
-//
-// Copyright (C) 2009 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-#if !MOBILE
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Reflection;
-
-namespace System.ComponentModel.DataAnnotations
-{
- class AssociatedMetadataTypePropertyDescriptor : ReflectionPropertyDescriptor
- {
- MemberInfo metaTypeMember;
-
- public AssociatedMetadataTypePropertyDescriptor (PropertyInfo typeProperty, MemberInfo metaTypeMember)
- : base (typeProperty)
- {
- this.metaTypeMember = metaTypeMember;
- }
-
- protected override void FillAttributes (IList attributeList)
- {
- base.FillAttributes (attributeList);
- if (metaTypeMember == null)
- return;
-
- object[] attributes = metaTypeMember.GetCustomAttributes (false);
- if (attributes == null || attributes.Length == 0)
- return;
-
- foreach (object o in attributes) {
- var attr = o as Attribute;
- if (attr == null)
- continue;
-
- attributeList.Add (attr);
- }
- }
- }
-}
-#endif
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/AssociatedMetadataTypeTypeDescriptionProvider.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/AssociatedMetadataTypeTypeDescriptionProvider.cs
deleted file mode 100644
index 212999a5e35..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/AssociatedMetadataTypeTypeDescriptionProvider.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// AssociatedMetadataTypeTypeDescriptionProvider.cs
-//
-// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2008 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-#if !MOBILE
-using System;
-using System.ComponentModel;
-
-namespace System.ComponentModel.DataAnnotations
-{
- public class AssociatedMetadataTypeTypeDescriptionProvider : TypeDescriptionProvider
- {
- Type type;
- Type associatedMetadataType;
-
- public AssociatedMetadataTypeTypeDescriptionProvider (Type type)
- {
- if (type == null)
- throw new ArgumentNullException ("type");
-
- this.type = type;
- }
-
- public AssociatedMetadataTypeTypeDescriptionProvider (Type type, Type associatedMetadataType)
- {
- if (type == null)
- throw new ArgumentNullException ("type");
- if (associatedMetadataType == null)
- throw new ArgumentNullException ("associatedMetadataType");
-
- this.type = type;
- this.associatedMetadataType = associatedMetadataType;
- }
-
- public override ICustomTypeDescriptor GetTypeDescriptor (Type objectType, object instance)
- {
- return new AssociatedMetadataTypeTypeDescriptor (base.GetTypeDescriptor (objectType, instance), type, associatedMetadataType);
- }
- }
-}
-#endif
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/AssociatedMetadataTypeTypeDescriptor.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/AssociatedMetadataTypeTypeDescriptor.cs
deleted file mode 100644
index 12307ff4b3b..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/AssociatedMetadataTypeTypeDescriptor.cs
+++ /dev/null
@@ -1,170 +0,0 @@
-//
-// AssociatedMetadataTypeTypeDescriptionProvider.cs
-//
-// Author:
-// Marek Habersack <mhabersack@novell.com>
-//
-// Copyright (C) 2009 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-#if !MOBILE
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Reflection;
-
-namespace System.ComponentModel.DataAnnotations
-{
- class AssociatedMetadataTypeTypeDescriptor : CustomTypeDescriptor
- {
- Type type;
- Type associatedMetadataType;
- bool associatedMetadataTypeChecked;
- PropertyDescriptorCollection properties;
-
- Type AssociatedMetadataType {
- get {
- if (!associatedMetadataTypeChecked && associatedMetadataType == null)
- associatedMetadataType = FindMetadataType ();
-
- return associatedMetadataType;
- }
- }
-
- public AssociatedMetadataTypeTypeDescriptor (ICustomTypeDescriptor parent, Type type)
- : this (parent, type, null)
- {
- }
-
- public AssociatedMetadataTypeTypeDescriptor (ICustomTypeDescriptor parent, Type type, Type associatedMetadataType)
- : base (parent)
- {
- this.type = type;
- this.associatedMetadataType = associatedMetadataType;
- }
-
- void CopyAttributes (object[] from, List <Attribute> to)
- {
- foreach (object o in from) {
- Attribute a = o as Attribute;
- if (a == null)
- continue;
-
- to.Add (a);
- }
- }
-
- public override AttributeCollection GetAttributes ()
- {
- var attributes = new List <Attribute> ();
- CopyAttributes (type.GetCustomAttributes (true), attributes);
-
- Type metaType = AssociatedMetadataType;
- if (metaType != null)
- CopyAttributes (metaType.GetCustomAttributes (true), attributes);
-
- return new AttributeCollection (attributes.ToArray ());
- }
-
- public override PropertyDescriptorCollection GetProperties ()
- {
- // Code partially copied from TypeDescriptor.TypeInfo.GetProperties
- if (properties != null)
- return properties;
-
- Dictionary <string, MemberInfo> metaMembers = null;
- var propertiesHash = new Dictionary <string, bool> (); // name - null
- var propertiesList = new List <AssociatedMetadataTypePropertyDescriptor> ();
- Type currentType = type;
- Type metaType = AssociatedMetadataType;
-
- if (metaType != null) {
- metaMembers = new Dictionary <string, MemberInfo> ();
- MemberInfo[] members = metaType.GetMembers (BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
-
- foreach (MemberInfo member in members) {
- switch (member.MemberType) {
- case MemberTypes.Field:
- case MemberTypes.Property:
- break;
-
- default:
- continue;
- }
-
- string name = member.Name;
- if (metaMembers.ContainsKey (name))
- continue;
-
- metaMembers.Add (name, member);
- }
- }
-
- // Getting properties type by type, because in the case of a property in the child type, where
- // the "new" keyword is used and also the return type is changed Type.GetProperties returns
- // also the parent property.
- //
- // Note that we also have to preserve the properties order here.
- //
- while (currentType != null && currentType != typeof (object)) {
- PropertyInfo[] props = currentType.GetProperties (BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
- foreach (PropertyInfo property in props) {
- string propName = property.Name;
-
- if (property.GetIndexParameters ().Length == 0 && property.CanRead && !propertiesHash.ContainsKey (propName)) {
- MemberInfo metaMember;
-
- if (metaMembers != null)
- metaMembers.TryGetValue (propName, out metaMember);
- else
- metaMember = null;
- propertiesList.Add (new AssociatedMetadataTypePropertyDescriptor (property, metaMember));
- propertiesHash.Add (propName, true);
- }
- }
- currentType = currentType.BaseType;
- }
-
- properties = new PropertyDescriptorCollection ((PropertyDescriptor[]) propertiesList.ToArray (), true);
- return properties;
- }
-
- Type FindMetadataType ()
- {
- associatedMetadataTypeChecked = true;
- if (type == null)
- return null;
-
- object[] attrs = type.GetCustomAttributes (typeof (MetadataTypeAttribute), true);
- if (attrs == null || attrs.Length == 0)
- return null;
-
- var attr = attrs [0] as MetadataTypeAttribute;
- if (attr == null)
- return null;
-
- return attr.MetadataClassType;
- }
- }
-}
-#endif
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/AssociationAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/AssociationAttribute.cs
deleted file mode 100644
index 7624c6090b9..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/AssociationAttribute.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-// AssociationAttribute.cs
-//
-// Authors:
-// Marek Habersack <mhabersack@novell.com>
-//
-// Copyright (C) 2010 Novell Inc. (http://novell.com)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-#if NET_4_0
-using System;
-using System.Collections.Generic;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsage (AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
- public sealed class AssociationAttribute : Attribute
- {
- static readonly char[] keySplitChars = { ',' };
-
- IEnumerable <string> otherKeyMembers;
- IEnumerable <string> thisKeyMembers;
-
- public bool IsForeignKey { get; set; }
- public string Name { get; private set; }
- public string OtherKey { get; private set; }
-
- public IEnumerable<string> OtherKeyMembers {
- get {
- if (otherKeyMembers == null)
- otherKeyMembers = GetKeyMembers (OtherKey);
-
- return otherKeyMembers;
- }
- }
-
- public string ThisKey { get; private set; }
-
- public IEnumerable<string> ThisKeyMembers {
- get {
- if (thisKeyMembers == null)
- thisKeyMembers = GetKeyMembers (ThisKey);
-
- return thisKeyMembers;
- }
- }
-
- public AssociationAttribute (string name, string thisKey, string otherKey)
- {
- this.Name = name;
- this.ThisKey = thisKey;
- this.OtherKey = otherKey;
- }
-
- IEnumerable <string> GetKeyMembers (string key)
- {
- // .NET emulation
- if (key == null)
- throw new NullReferenceException (".NET emulation");
-
- string nows = key.Replace (" ", String.Empty);
- if (nows.Length == 0)
- return new string[] { String.Empty };
-
- return nows.Split (keySplitChars);
- }
- }
-}
-#endif
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ChangeLog b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ChangeLog
deleted file mode 100644
index 1bfd423525f..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ChangeLog
+++ /dev/null
@@ -1,64 +0,0 @@
-2010-05-26 Marek Habersack <mhabersack@novell.com>
-
- * ValidationAttribute.cs: cope with null/empty ErrorMessageString
- in FormatErrorMessage
-
-2010-05-12 Marek Habersack <mhabersack@novell.com>
-
- * ValidationException.cs: partially implemented
-
- * ValidationAttribute.cs: implemented
-
- * RequiredAttribute.cs: implemented. Fixes bug #604100
-
- * AssociationAttribute.cs, ConcurrencyCheckAttribute.cs,
- CustomValidationAttribute.cs, EditableAttribute.cs,
- EnumDataTypeAttribute.cs, IValidatableObject.cs,
- ValidationContext.cs, ValidationResult.cs: added
-
-2009-09-15 Marek Habersack <mhabersack@novell.com>
-
- * DataTypeAttribute.cs: implemented GetDataTypeName
-
-2009-06-23 Marek Habersack <mhabersack@novell.com>
-
- * ValidationAttribute.cs: error message must not ever be empty.
-
- * UIHintAttribute.cs: do not throw NIEX from the constructor.
-
- * DataTypeAttribute.cs: implemented correct DisplayFormat
- intialization for DataType.Time.
-
- * AssociatedMetadataTypeTypeDescriptor.cs: implemented retrieving
- attributes of the associated metadata type, as well as merging of
- attribute collections between metadata and main type properties.
-
- * AssociatedMetadataTypePropertyDescriptor.cs: added. Helper class
- which merges attributes from the metadata type (if any) with those
- associated with property from the "main" type.
-
-2009-04-23 Marek Habersack <mhabersack@novell.com>
-
- * AssociatedMetadataTypeTypeDescriptor.cs: added - doesn't add any
- real functionality yet.
-
- * AssociatedMetadataTypeTypeDescriptionProvider.cs: implemented
- all the methods.
-
-2008-10-14 Atsushi Enomoto <atsushi@ximian.com>
-
- * AssociatedMetadataTypeTypeDescriptionProvider.cs
- DataType.cs
- DataTypeAttribute.cs
- DisplayColumnAttribute.cs
- DisplayFormatAttribute.cs
- MetadataTypeAttribute.cs
- RangeAttribute.cs
- RegularExpressionAttribute.cs
- RequiredAttribute.cs
- ScaffoldColumnAttribute.cs
- ScaffoldTableAttribute.cs
- StringLengthAttribute.cs
- UIHintAttribute.cs
- ValidationAttribute.cs
- ValidationException.cs: initial checkin. mostly stubs.
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/CompareAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/CompareAttribute.cs
deleted file mode 100644
index afec3c9a089..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/CompareAttribute.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-//
-// CompareAttribute.cs
-//
-// Authors:
-// Pablo Ruiz García <pablo.ruiz@gmail.com>
-//
-// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
-// Copyright (C) 2013 Pablo Ruiz García
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_5
-
-using System;
-using System.Linq;
-using System.Globalization;
-using System.ComponentModel;
-using System.Collections.Generic;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsageAttribute (AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
- public class CompareAttribute : ValidationAttribute
- {
- private const string DefaultErrorMessage = "'{0}' and '{1}' do not match.";
- private const string NonExistingPropertyErrorMessage = "Could not find a property named {0}.";
- private string _otherProperty;
- private string _otherPropertyDisplayName;
-
- public CompareAttribute (string otherProperty)
- : base (() => DefaultErrorMessage)
- {
- if (string.IsNullOrEmpty (otherProperty))
- throw new ArgumentNullException ("otherProperty");
-
- _otherProperty = otherProperty;
- }
-
- public string OtherProperty { get { return _otherProperty; } }
- public string OtherPropertyDisplayName { get { return _otherPropertyDisplayName; } }
- public override bool RequiresValidationContext { get { return true; } }
-
- private IEnumerable<Attribute> GetPropertyAttributes (Type type, string propertyName)
- {
-#if MOBILE
- return TypeDescriptor.GetProperties (type).Find (propertyName, false).Attributes.OfType<Attribute> ();
-#else
- // Using AMTTDP seems the way to go to be able to relay on attributes declared
- // by means of associated classes not directly decorating the property.
- // See: http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.associatedmetadatatypetypedescriptionprovider.aspx
- return new AssociatedMetadataTypeTypeDescriptionProvider (type)
- .GetTypeDescriptor (type)
- .GetProperties ()
- .Find (propertyName, false)
- .Attributes.OfType<Attribute> ();
-#endif
- }
-
- private void ResolveOtherPropertyDisplayName (ValidationContext context)
- {
- if (_otherPropertyDisplayName == null)
- {
- // NOTE: From my own tests, it seems MS.NET looksup displayName from various sources, what follows
- // is a best guess from my on tests, however, I am probably missing some corner cases. (pruiz)
- var attributes = GetPropertyAttributes (context.ObjectType, _otherProperty);
- var displayAttr = attributes.FirstOrDefault (x => x is DisplayAttribute) as DisplayAttribute;
- var displayNameAttr = attributes.FirstOrDefault (x => x is DisplayNameAttribute) as DisplayNameAttribute;
-
- if (displayAttr != null) _otherPropertyDisplayName = displayAttr.GetName ();
- else if (displayNameAttr != null) _otherPropertyDisplayName = displayNameAttr.DisplayName;
- _otherPropertyDisplayName = _otherProperty;
- }
- }
-
- public override string FormatErrorMessage (string name)
- {
- var oname = string.IsNullOrEmpty (_otherPropertyDisplayName) ? _otherProperty : _otherPropertyDisplayName;
- return string.Format (ErrorMessageString, name, oname);
- }
-
- protected override ValidationResult IsValid(object value, ValidationContext context)
- {
- var property = context.ObjectType.GetProperty (_otherProperty);
-
- if (property == null) {
- string message = string.Format (NonExistingPropertyErrorMessage, _otherProperty);
- return new ValidationResult (message);
- }
-
- // XXX: Could not find a better place to call this, as this is
- // the only place we have access to a ValidationContext. (pruiz)
- ResolveOtherPropertyDisplayName (context);
-
- return object.Equals (property.GetValue (context.ObjectInstance, null), value) ? null
- : new ValidationResult (FormatErrorMessage (context.DisplayName));
- }
- }
-}
-
-#endif
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ConcurrencyCheckAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ConcurrencyCheckAttribute.cs
deleted file mode 100644
index 6d5cdc72435..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ConcurrencyCheckAttribute.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// ConcurrencyCheckAttribute.cs
-//
-// Authors:
-// Marek Habersack <mhabersack@novell.com>
-//
-// Copyright (C) 2010 Novell Inc. (http://novell.com)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-#if NET_4_0
-using System;
-using System.Collections.Generic;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsage (AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
- public sealed class ConcurrencyCheckAttribute : Attribute
- {
- public ConcurrencyCheckAttribute ()
- {
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ControlParameters.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ControlParameters.cs
deleted file mode 100644
index 98f7c5a81dc..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ControlParameters.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-//
-// ControlParameters.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-//
-// Copyright (C) 2013 Xamarin Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace System.ComponentModel.DataAnnotations
-{
- sealed class ControlParameters : IEquatable<ControlParameters>
- {
- Dictionary<string, object> dictionary;
- readonly object[] parameters;
-
- public ControlParameters (object[] parameters)
- {
- this.parameters = parameters;
- }
-
- public Dictionary<string, object> Dictionary {
- get {
- return dictionary ?? (dictionary = CreateDictionary ());
- }
- }
-
- public bool Equals (ControlParameters other)
- {
- if (parameters == null || other.parameters == null)
- return ReferenceEquals (parameters, other.parameters);
-
- if (parameters.Length != other.parameters.Length)
- return false;
-
- try {
- return Dictionary.OrderBy (l => l.Key).SequenceEqual (other.Dictionary.OrderBy (l => l.Key));
- } catch (InvalidOperationException) {
- return false;
- }
- }
-
- Dictionary<string, object> CreateDictionary ()
- {
- if (parameters == null || parameters.Length == 0) {
- return new Dictionary<string, object> (0);
- }
-
- if (parameters.Length % 2 != 0)
- throw new InvalidOperationException ();
-
- var dict = new Dictionary<string, object> ();
- for (int i = 0; i < parameters.Length; ) {
- var key = parameters [i++] as string;
- if (key == null)
- throw new InvalidOperationException ();
-
- try {
- dict.Add (key, parameters[i++]);
- } catch (System.ArgumentException) {
- throw new InvalidOperationException ();
- }
- }
-
- return dict;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/CreditCardAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/CreditCardAttribute.cs
deleted file mode 100644
index 66fdc90759c..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/CreditCardAttribute.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-//
-// CreditCardAttribute.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-// Pablo Ruiz García <pablo.ruiz@gmail.com>
-//
-// Copyright (C) 2013 Xamarin Inc (http://www.xamarin.com)
-// Copyright (C) 2013 Pablo Ruiz García
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_5
-
-using System;
-using System.Linq;
-using System.Globalization;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsageAttribute (AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
- public class CreditCardAttribute : DataTypeAttribute
- {
- private const string DefaultErrorMessage = "The {0} field is not a valid credit card number.";
-
- public CreditCardAttribute ()
- : base(DataType.CreditCard)
- {
- // XXX: There is no .ctor accepting Func<string> on DataTypeAttribute.. :?
- base.ErrorMessage = DefaultErrorMessage;
- }
-
- public override bool IsValid(object value)
- {
- if (value == null)
- return true;
-
- if (string.IsNullOrEmpty(value as string))
- return false;
-
- // Remove any invalid characters..
- var creditCardNumber = (value as string).Replace("-", "").Replace(" ", "");
-
- if (creditCardNumber.Any (x => !Char.IsDigit (x)))
- return false;
-
- // Performan a Luhn-based check against credit card number.
- //
- // See: http://en.wikipedia.org/wiki/Luhn_algorithm
- // See: http://rosettacode.org/wiki/Luhn_test_of_credit_card_numbers
-
- return true;
- }
- }
-}
-
-#endif
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/CustomValidationAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/CustomValidationAttribute.cs
deleted file mode 100644
index 618dd881891..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/CustomValidationAttribute.cs
+++ /dev/null
@@ -1,141 +0,0 @@
-//
-// CustomValidationAttribute.cs
-//
-// Authors:
-// Marek Habersack <grendel@twistedcode.net>
-//
-// Copyright (C) 2010-2011 Novell Inc. (http://novell.com)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-#if NET_4_0
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsage (AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = true)]
- public sealed class CustomValidationAttribute : ValidationAttribute
- {
- Tuple <string, Type> typeId;
- MethodInfo validationMethod;
- bool validationMethodChecked;
- bool validationMethodSignatureValid;
- int validationMethodParamCount;
-
- public string Method { get; private set; }
-
- public override object TypeId {
- get { return typeId; }
- }
-
- public Type ValidatorType { get; private set; }
-
- public CustomValidationAttribute (Type validatorType, string method)
- {
- this.ValidatorType = validatorType;
- this.Method = method;
- this.typeId = new Tuple <string, Type> (method, validatorType);
- }
-
- public override string FormatErrorMessage (string name)
- {
- ThrowIfAttributeNotWellFormed ();
- return String.Format ("{0} is not valid.", name);
- }
-
- // LAMESPEC: MSDN doesn't document it at all, but corcompare shows it in the type
- protected override ValidationResult IsValid (object value, ValidationContext validationContext)
- {
- ThrowIfAttributeNotWellFormed ();
- object[] p;
-
- if (validationMethodParamCount == 2)
- p = new object [] {value, validationContext};
- else
- p = new object [] {value};
- try {
- return validationMethod.Invoke (null, p) as ValidationResult;
- } catch (TargetInvocationException ex) {
- if (ex.InnerException != null)
- throw ex.InnerException;
- throw;
- }
- }
-
- void ThrowIfAttributeNotWellFormed ()
- {
- Type type = ValidatorType;
- if (type == null)
- throw new InvalidOperationException ("The CustomValidationAttribute.ValidatorType was not specified.");
-
- if (type.IsNotPublic)
- throw new InvalidOperationException (String.Format ("The custom validation type '{0}' must be public.", type.Name));
-
- string method = Method;
- if (String.IsNullOrEmpty (method))
- throw new InvalidOperationException ("The CustomValidationAttribute.Method was not specified.");
-
- if (validationMethod == null) {
- if (!validationMethodChecked) {
- validationMethod = type.GetMethod (method, BindingFlags.Public | BindingFlags.Static);
- validationMethodChecked = true;
- }
-
- if (validationMethod == null)
- throw new InvalidOperationException (
- String.Format ("The CustomValidationAttribute method '{0}' does not exist in type '{1}' or is not public and static.",
- method, type.Name));
-
- if (!typeof (ValidationResult).IsAssignableFrom (validationMethod.ReturnType))
- throw new InvalidOperationException (String.Format ("The CustomValidationAttribute method '{0}' in type '{1}' must return System.ComponentModel.DataAnnotations.ValidationResult. Use System.ComponentModel.DataAnnotations.ValidationResult.Success to represent success.", method, type.Name));
-
- validationMethodSignatureValid = true;
- ParameterInfo[] parameters = validationMethod.GetParameters ();
- if (parameters == null)
- validationMethodSignatureValid = false;
- else {
- validationMethodParamCount = parameters.Length;
- switch (validationMethodParamCount) {
- case 1:
- break;
-
- case 2:
- if (parameters [1].ParameterType != typeof (ValidationContext))
- validationMethodSignatureValid = false;
- break;
-
- default:
- validationMethodSignatureValid = false;
- break;
- }
- }
- }
-
- if (!validationMethodSignatureValid)
- throw new InvalidOperationException (String.Format ("The CustomValidationAttribute method '{0}' in type '{1}' must match the expected signature: public static ValidationResult MethodTwo(object value, ValidationContext context). The value can be strongly typed. The ValidationContext parameter is optional.", method, type.Name));
-
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DataType.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DataType.cs
deleted file mode 100644
index 5ad56e74984..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DataType.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// DataType.cs
-//
-// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2008-2011 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.ComponentModel.DataAnnotations
-{
- public enum DataType
- {
- Custom,
- DateTime,
- Date,
- Time,
- Duration,
- PhoneNumber,
- Currency,
- Text,
- Html,
- MultilineText,
- EmailAddress,
- Password,
- Url,
-#if NET_4_0
- ImageUrl,
-#endif
-#if NET_4_5
- CreditCard,
- PostalCode,
- Upload
-#endif
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DataTypeAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DataTypeAttribute.cs
deleted file mode 100644
index 3a373db8545..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DataTypeAttribute.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-//
-// DataTypeAttribute.cs
-//
-// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
-// Pablo Ruiz García <pablo.ruiz@gmail.com>
-//
-// Copyright (C) 2008 Novell Inc. http://novell.com
-// Copyright (C) 2013 Pablo Ruiz García
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.ComponentModel;
-
-namespace System.ComponentModel.DataAnnotations
-{
-#if NET_4_0
- [AttributeUsage (AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = false)]
-#else
- [AttributeUsage (AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false)]
-#endif
- public class DataTypeAttribute : ValidationAttribute
- {
- public DataTypeAttribute (DataType dataType)
- {
- DataType = dataType;
-
- DisplayFormatAttribute displayFormat;
- switch (dataType) {
- case DataType.Time:
- displayFormat = new DisplayFormatAttribute ();
- displayFormat.ApplyFormatInEditMode = true;
- displayFormat.ConvertEmptyStringToNull = true;
- displayFormat.DataFormatString = "{0:t}";
-#if NET_4_0
- displayFormat.HtmlEncode = true;
-#endif
- break;
- case DataType.Date:
- displayFormat = new DisplayFormatAttribute ();
- displayFormat.ApplyFormatInEditMode = true;
- displayFormat.ConvertEmptyStringToNull = true;
- displayFormat.DataFormatString = "{0:d}";
-#if NET_4_0
- displayFormat.HtmlEncode = true;
-#endif
- break;
- case DataType.Currency:
- displayFormat = new DisplayFormatAttribute ();
- displayFormat.ApplyFormatInEditMode = false;
- displayFormat.ConvertEmptyStringToNull = true;
- displayFormat.DataFormatString = "{0:C}";
-#if NET_4_0
- displayFormat.HtmlEncode = true;
-#endif
- break;
-
- default:
- displayFormat = null;
- break;
- }
-
- DisplayFormat = displayFormat;
- }
-
- public DataTypeAttribute (string customDataType)
- {
- CustomDataType = customDataType;
- }
-
- public string CustomDataType { get; private set; }
- public DataType DataType { get; private set; }
- public DisplayFormatAttribute DisplayFormat { get; protected set; }
-
- public virtual string GetDataTypeName ()
- {
- DataType dt = DataType;
- if (dt == DataType.Custom)
- return CustomDataType;
-
- return dt.ToString ();
- }
-
- public override bool IsValid (object value)
- {
- // Returns alwasy true
- // See: http://msdn.microsoft.com/en-us/library/cc679235.aspx
- return true;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DisplayAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DisplayAttribute.cs
deleted file mode 100644
index ffdd5bdad7f..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DisplayAttribute.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-//
-// DisplayAttribute.cs
-//
-// Author:
-// David Stone <david@gixug.com>
-//
-// Copyright (C) 2010 David Stone
-//
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.ComponentModel;
-
-namespace System.ComponentModel.DataAnnotations
-{
-#if NET_4_0
- [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple = false)]
- public sealed class DisplayAttribute : Attribute
- {
- public Type ResourceType { get; set; }
-
- public string Description { get; set; }
- public string GroupName { get; set; }
- public string Name { get; set; }
- public string ShortName { get; set; }
- public string Prompt { get; set; }
-
- const string property_not_set_message = "The {0} property has not been set. Use the Get{0} method to get the value.";
- const string localization_failed_message = "Cannot retrieve property '{0}' because localization failed. Type '{1} is not public or does not contain a public static string property with the name '{2}'.";
-
- bool? _autoGenerateField;
- public bool AutoGenerateField {
- get {
- if (!_autoGenerateField.HasValue) {
- throw new InvalidOperationException (string.Format (property_not_set_message, "AutoGenerateField"));
- }
-
- return _autoGenerateField.Value;
- }
- set { _autoGenerateField = value; }
- }
-
- bool? _autoGenerateFilter;
- public bool AutoGenerateFilter {
- get {
- if (_autoGenerateFilter == null) {
- throw new InvalidOperationException (string.Format (property_not_set_message, "AutoGenerateFilter"));
- }
-
- return _autoGenerateFilter.Value;
- }
- set { _autoGenerateFilter = value; }
- }
-
- int? _order;
- public int Order {
- get {
- if (_order == null)
- throw new InvalidOperationException (string.Format (property_not_set_message, "Order"));
-
- return _order.Value;
- }
- set { _order = value; }
- }
-
- private string GetLocalizedString (string propertyName, string key)
- {
- // If we don't have a resource or a key, go ahead and fall back on the key
- if (ResourceType == null || key == null)
- return key;
-
- var property = ResourceType.GetProperty (key);
-
- // Strings are only valid if they are public static strings
- var isValid = false;
- if (ResourceType.IsVisible && property != null && property.PropertyType == typeof(string)) {
- var getter = property.GetGetMethod ();
-
- // Gotta have a public static getter on the property
- if (getter != null && getter.IsStatic && getter.IsPublic) {
- isValid = true;
- }
- }
-
- // If it's not valid, go ahead and throw an InvalidOperationException
- if (!isValid) {
- var message = string.Format (localization_failed_message, propertyName, ResourceType.ToString (), key);
- throw new InvalidOperationException (message);
- }
-
- return (string)property.GetValue (null, null);
-
- }
-
- #region Consumer Methods
- public bool? GetAutoGenerateField ()
- {
- return _autoGenerateField;
- }
-
- public bool? GetAutoGenerateFilter ()
- {
- return _autoGenerateFilter;
- }
-
- public int? GetOrder ()
- {
- return _order;
- }
-
- public string GetName ()
- {
- return GetLocalizedString ("Name", Name);
- }
-
- public string GetShortName ()
- {
- // Short name falls back on Name if the short name isn't set
- return GetLocalizedString ("ShortName", ShortName) ?? GetName ();
- }
-
- public string GetDescription ()
- {
- return GetLocalizedString ("Description", Description);
- }
-
- public string GetPrompt ()
- {
- return GetLocalizedString ("Prompt", Prompt);
- }
-
- public string GetGroupName ()
- {
- return GetLocalizedString ("GroupName", GroupName);
- }
-
- #endregion
-
- }
-#endif
-}
-
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DisplayColumnAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DisplayColumnAttribute.cs
deleted file mode 100644
index 301ee94cd18..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DisplayColumnAttribute.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-//
-// DisplayColumnAttribute.cs
-//
-// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2008 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.ComponentModel;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsage (AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
- public class DisplayColumnAttribute : Attribute
- {
- public DisplayColumnAttribute (string displayColumn)
- : this (displayColumn, null)
- {
- }
-
- public DisplayColumnAttribute (string displayColumn, string sortColumn)
- : this (displayColumn, sortColumn, false)
- {
- }
-
- public DisplayColumnAttribute (string displayColumn, string sortColumn, bool sortDescending)
- {
- DisplayColumn = displayColumn;
- SortColumn = sortColumn;
- SortDescending = sortDescending;
- }
-
- public string DisplayColumn { get; private set; }
- public string SortColumn { get; private set; }
- public bool SortDescending { get; private set; }
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DisplayFormatAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DisplayFormatAttribute.cs
deleted file mode 100644
index 4c48a83d2f0..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/DisplayFormatAttribute.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// DisplayFormatAttribute.cs
-//
-// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2008 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.ComponentModel;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsage (AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false)]
- public class DisplayFormatAttribute : Attribute
- {
- public bool ApplyFormatInEditMode { get; set; }
- public bool ConvertEmptyStringToNull { get; set; }
- public string DataFormatString { get; set; }
- public string NullDisplayText { get; set; }
-#if NET_4_0
- public bool HtmlEncode { get; set; }
-#endif
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/EditableAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/EditableAttribute.cs
deleted file mode 100644
index abfba998c24..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/EditableAttribute.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// EditableAttribute.cs
-//
-// Authors:
-// Marek Habersack <mhabersack@novell.com>
-//
-// Copyright (C) 2010 Novell Inc. (http://novell.com)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-#if NET_4_0
-using System;
-using System.Collections.Generic;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsage (AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
- public sealed class EditableAttribute : Attribute
- {
- public bool AllowEdit { get; private set; }
- public bool AllowInitialValue { get; set; }
-
- public EditableAttribute (bool allowEdit)
- {
- this.AllowEdit = allowEdit;
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/EmailAddressAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/EmailAddressAttribute.cs
deleted file mode 100644
index 5d79b926c19..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/EmailAddressAttribute.cs
+++ /dev/null
@@ -1,313 +0,0 @@
-//
-// EmailAddressAttribute.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-// Pablo Ruiz García <pablo.ruiz@gmail.com>
-//
-// Copyright (C) 2013 Xamarin Inc (http://www.xamarin.com)
-// Copyright (C) 2013 Pablo Ruiz García
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_5
-
-using System;
-using System.Globalization;
-using System.Text.RegularExpressions;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsageAttribute (AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
- public class EmailAddressAttribute : DataTypeAttribute
- {
- private const string DefaultErrorMessage = "The {0} field is not a valid e-mail address.";
- const string AtomCharacters = "!#$%&'*+-/=?^_`{|}~";
-
- static bool IsLetterOrDigit (char c)
- {
- return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9');
- }
-
- static bool IsAtom (char c)
- {
- return IsLetterOrDigit (c) || AtomCharacters.IndexOf (c) != -1;
- }
-
- static bool IsDomain (char c)
- {
- return IsLetterOrDigit (c) || c == '-';
- }
-
- static bool SkipAtom (string text, ref int index)
- {
- int startIndex = index;
-
- while (index < text.Length && IsAtom (text[index]))
- index++;
-
- return index > startIndex;
- }
-
- static bool SkipSubDomain (string text, ref int index)
- {
- if (!IsDomain (text[index]) || text[index] == '-')
- return false;
-
- index++;
-
- while (index < text.Length && IsDomain (text[index]))
- index++;
-
- return true;
- }
-
- static bool SkipDomain (string text, ref int index)
- {
- if (!SkipSubDomain (text, ref index))
- return false;
-
- while (index < text.Length && text[index] == '.') {
- index++;
-
- if (index == text.Length)
- return false;
-
- if (!SkipSubDomain (text, ref index))
- return false;
- }
-
- return true;
- }
-
- static bool SkipQuoted (string text, ref int index)
- {
- bool escaped = false;
-
- // skip over leading '"'
- index++;
-
- while (index < text.Length) {
- if (text[index] == (byte) '\\') {
- escaped = !escaped;
- } else if (!escaped) {
- if (text[index] == (byte) '"')
- break;
- } else {
- escaped = false;
- }
-
- index++;
- }
-
- if (index >= text.Length || text[index] != (byte) '"')
- return false;
-
- index++;
-
- return true;
- }
-
- static bool SkipWord (string text, ref int index)
- {
- if (text[index] == (byte) '"')
- return SkipQuoted (text, ref index);
-
- return SkipAtom (text, ref index);
- }
-
- static bool SkipIPv4Literal (string text, ref int index)
- {
- int groups = 0;
-
- while (index < text.Length && groups < 4) {
- int startIndex = index;
- int value = 0;
-
- while (index < text.Length && text[index] >= '0' && text[index] <= '9') {
- value = (value * 10) + (text[index] - '0');
- index++;
- }
-
- if (index == startIndex || index - startIndex > 3 || value > 255)
- return false;
-
- groups++;
-
- if (groups < 4 && index < text.Length && text[index] == '.')
- index++;
- }
-
- return groups == 4;
- }
-
- static bool IsHexDigit (char c)
- {
- return (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f') || (c >= '0' && c <= '9');
- }
-
- // This needs to handle the following forms:
- //
- // IPv6-addr = IPv6-full / IPv6-comp / IPv6v4-full / IPv6v4-comp
- // IPv6-hex = 1*4HEXDIG
- // IPv6-full = IPv6-hex 7(":" IPv6-hex)
- // IPv6-comp = [IPv6-hex *5(":" IPv6-hex)] "::" [IPv6-hex *5(":" IPv6-hex)]
- // ; The "::" represents at least 2 16-bit groups of zeros
- // ; No more than 6 groups in addition to the "::" may be
- // ; present
- // IPv6v4-full = IPv6-hex 5(":" IPv6-hex) ":" IPv4-address-literal
- // IPv6v4-comp = [IPv6-hex *3(":" IPv6-hex)] "::"
- // [IPv6-hex *3(":" IPv6-hex) ":"] IPv4-address-literal
- // ; The "::" represents at least 2 16-bit groups of zeros
- // ; No more than 4 groups in addition to the "::" and
- // ; IPv4-address-literal may be present
- static bool SkipIPv6Literal (string text, ref int index)
- {
- bool compact = false;
- int colons = 0;
-
- while (index < text.Length) {
- int startIndex = index;
-
- while (index < text.Length && IsHexDigit (text[index]))
- index++;
-
- if (index >= text.Length)
- break;
-
- if (index > startIndex && colons > 2 && text[index] == '.') {
- // IPv6v4
- index = startIndex;
-
- if (!SkipIPv4Literal (text, ref index))
- return false;
-
- break;
- }
-
- int count = index - startIndex;
- if (count > 4)
- return false;
-
- if (text[index] != ':')
- break;
-
- startIndex = index;
- while (index < text.Length && text[index] == ':')
- index++;
-
- count = index - startIndex;
- if (count > 2)
- return false;
-
- if (count == 2) {
- if (compact)
- return false;
-
- compact = true;
- colons += 2;
- } else {
- colons++;
- }
- }
-
- if (colons < 2)
- return false;
-
- if (compact)
- return colons < 6;
-
- return colons < 7;
- }
-
- static bool Validate (string email)
- {
- int index = 0;
-
- if (email.Length == 0)
- return false;
-
- if (!SkipWord (email, ref index) || index >= email.Length)
- return false;
-
- while (index < email.Length && email[index] == '.') {
- index++;
-
- if (!SkipWord (email, ref index) || index >= email.Length)
- return false;
- }
-
- if (index + 1 >= email.Length || email[index++] != '@')
- return false;
-
- if (email[index] != '[') {
- // domain
- if (!SkipDomain (email, ref index))
- return false;
-
- return index == email.Length;
- }
-
- // address literal
- index++;
-
- // we need at least 8 more characters
- if (index + 8 >= email.Length)
- return false;
-
- var ipv6 = email.Substring (index, 5);
- if (ipv6.ToLowerInvariant () == "ipv6:") {
- index += "IPv6:".Length;
- if (!SkipIPv6Literal (email, ref index))
- return false;
- } else {
- if (!SkipIPv4Literal (email, ref index))
- return false;
- }
-
- if (index >= email.Length || email[index++] != ']')
- return false;
-
- return index == email.Length;
- }
-
- public EmailAddressAttribute ()
- : base(DataType.EmailAddress)
- {
- // XXX: There is no .ctor accepting Func<string> on DataTypeAttribute.. :?
- base.ErrorMessage = DefaultErrorMessage;
- }
-
- public override bool IsValid(object value)
- {
- if (value == null)
- return true;
-
- string email = value as string;
- if (email == null)
- return false;
-
- return Validate (email);
- }
- }
-}
-
-#endif
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/EnumDataTypeAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/EnumDataTypeAttribute.cs
deleted file mode 100644
index a0efa1e846d..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/EnumDataTypeAttribute.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-//
-// EnumDataTypeAttribute.cs
-//
-// Authors:
-// Marek Habersack <mhabersack@novell.com>
-//
-// Copyright (C) 2010 Novell Inc. (http://novell.com)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-#if NET_4_0
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Globalization;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsage (AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
- public sealed class EnumDataTypeAttribute : DataTypeAttribute
- {
- public Type EnumType { get; private set; }
-
- public EnumDataTypeAttribute (Type enumType)
- : base (DataType.Custom)
- {
- this.EnumType = enumType;
- }
-
- public override bool IsValid (object value)
- {
- Type type = EnumType;
-
- if (!type.IsEnum)
- throw new InvalidOperationException (
- String.Format ("The type '{0}' needs to represent an enumeration type.", type.FullName)
- );
-
- if (value == null)
- return true;
-
- Type valueType = value.GetType ();
- if (valueType.IsEnum && valueType != type)
- return false;
-
- string s = value as string;
- if (s != null && s.Length == 0)
- return true;
-
- if (s != null && (valueType == typeof (bool) || valueType == typeof (char) || valueType == typeof (float)))
- return false;
-
- object o;
-
- if (s != null) {
- try {
- o = Enum.Parse (type, s);
- } catch {
- return false;
- }
- } else if (valueType.IsEnum)
- o = value;
- else {
- try {
- o = Enum.ToObject (type, value);
- } catch {
- return false;
- }
- }
-
- object[] attrs = type.GetCustomAttributes (typeof (FlagsAttribute), true);
- if (attrs != null && attrs.Length > 0) {
- string sval = Convert.ChangeType (o, Enum.GetUnderlyingType (type), CultureInfo.InvariantCulture).ToString ();
-
- // This looks weird, but what happens here is that if we have a
- // mismatch, the above type change will make sval equal o.ToString
- // () and if we have a match, then sval will be string
- // representation of the enum member's value. So, if we have an
- // enum:
- //
- // [Flags]
- // enum Test
- // {
- // One = 1,
- // Two = 2
- // }
- //
- // And the passed value was 3, then o.ToString () == "One, Two" and
- // sval == "3". If the passed value was 33, though, o.ToString () ==
- // "33" and sval == "33" - thus we DON'T have a match.
- return !sval.Equals (o.ToString ());
- }
-
- return Enum.IsDefined (type, o);
- }
- }
-}
-#endif \ No newline at end of file
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/FileExtensionsAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/FileExtensionsAttribute.cs
deleted file mode 100644
index de9c384d64a..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/FileExtensionsAttribute.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-//
-// FileExtensionAttribute.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-// Pablo Ruiz García <pablo.ruiz@gmail.com>
-//
-// Copyright (C) 2013 Xamarin Inc (http://www.xamarin.com)
-// Copyright (C) 2013 Pablo Ruiz García
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_5
-
-using System;
-using System.Linq;
-using System.Globalization;
-using System.Text.RegularExpressions;
-
-namespace System.ComponentModel.DataAnnotations
-{
- // See: http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.fileextensionsattribute.aspx
-
- [AttributeUsageAttribute (AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
- public class FileExtensionsAttribute : DataTypeAttribute
- {
- private const string DefaultErrorMessage = "The {0} field only accepts files with the following extensions: {1}.";
- private const string DefaultExtensions = "png,jpg,jpeg,gif";
-
- public FileExtensionsAttribute ()
- : base (DataType.Upload)
- {
- // XXX: There is no .ctor accepting Func<string> on DataTypeAttribute.. :?
- base.ErrorMessage = DefaultErrorMessage;
- this.Extensions = DefaultExtensions;
- }
-
- public string Extensions { get; set; }
-
- private string[] GetExtensionList ()
- {
- return (Extensions ?? "").Split (',');
- }
-
- private string GetExtension (string filename)
- {
- var parts = filename.Split ('.');
- return parts.Length > 0 ? parts [parts.Length - 1] : "";
- }
-
- public override string FormatErrorMessage (string name)
- {
- var extensions = GetExtensionList().Aggregate ((cur, next) => cur + ", " + next);
- return string.Format (ErrorMessageString, name, extensions);
- }
-
- public override bool IsValid(object value)
- {
- if (value == null)
- return true;
-
- if (value is string)
- {
- var str = value as string;
- var ext = GetExtension (str);
- return GetExtensionList ().Any (x => string.Equals (x, ext, StringComparison.InvariantCultureIgnoreCase));
- }
-
- return false;
- }
- }
-}
-
-#endif
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/FilterUIHintAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/FilterUIHintAttribute.cs
deleted file mode 100644
index 870e4092d86..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/FilterUIHintAttribute.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-//
-// FilterUIHintAttribute.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-//
-// Copyright (C) 2013 Xamarin Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_0
-
-using System.Runtime.CompilerServices;
-using System.Collections.Generic;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsageAttribute (AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
- public sealed class FilterUIHintAttribute : Attribute
- {
- readonly ControlParameters controlParameters;
-
- public FilterUIHintAttribute (string filterUIHint)
- : this (filterUIHint, null, null)
- {
- }
-
- public FilterUIHintAttribute (string filterUIHint, string presentationLayer)
- : this (filterUIHint, presentationLayer, null)
- {
- }
-
- public FilterUIHintAttribute (string filterUIHint, string presentationLayer, params object[] controlParameters)
- {
- FilterUIHint = filterUIHint;
- PresentationLayer = presentationLayer;
- this.controlParameters = new ControlParameters (controlParameters);
- }
-
- public IDictionary<string, object> ControlParameters {
- get {
- return controlParameters.Dictionary;
- }
- }
-
- public string FilterUIHint { get; private set; }
-
- public string PresentationLayer { get; private set; }
-
- public override object TypeId {
- get {
- return this;
- }
- }
-
- public override int GetHashCode ()
- {
- return RuntimeHelpers.GetHashCode (FilterUIHint) ^
- RuntimeHelpers.GetHashCode (PresentationLayer);
- }
-
- public override bool Equals (object obj)
- {
- var fha = obj as FilterUIHintAttribute;
- if (fha == null)
- return false;
-
- return fha.FilterUIHint == FilterUIHint &&
- fha.PresentationLayer == PresentationLayer &&
- fha.controlParameters.Equals (controlParameters);
- }
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/IValidatableObject.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/IValidatableObject.cs
deleted file mode 100644
index cf68fc3669c..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/IValidatableObject.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// IValidatableObject.cs
-//
-// Authors:
-// Marek Habersack <mhabersack@novell.com>
-//
-// Copyright (C) 2010 Novell Inc. (http://novell.com)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-#if NET_4_0
-using System;
-using System.Collections.Generic;
-
-namespace System.ComponentModel.DataAnnotations
-{
- public interface IValidatableObject
- {
- IEnumerable<ValidationResult> Validate (ValidationContext validationContext);
- }
-}
-#endif
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/KeyAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/KeyAttribute.cs
deleted file mode 100644
index 37cde191cc3..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/KeyAttribute.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// KeyAttribute.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-//
-// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_0
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsageAttribute (AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
- public sealed class KeyAttribute : Attribute
- {
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/MaxLengthAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/MaxLengthAttribute.cs
deleted file mode 100644
index 84fab2a3a63..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/MaxLengthAttribute.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-// MaxLengthAttribute.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-// Pablo Ruiz García <pablo.ruiz@gmail.com>
-//
-// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_5
-
-using System;
-using System.Globalization;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsageAttribute (AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
- public class MaxLengthAttribute : ValidationAttribute
- {
- private const string DefaultErrorMessage = "The field {0} must be a string or array type with a maximum length of '{1}'.";
- private const string InvalidLengthErrorMessage = "MaxLengthAttribute must have a Length value that is greater than zero. " +
- "Use MaxLength() without parameters to indicate that the string or array can have the maximum allowable length.";
- private bool _maxLength = true;
-
- public MaxLengthAttribute ()
- : base (() => DefaultErrorMessage)
- {
- }
-
- public MaxLengthAttribute (int length)
- : this ()
- {
- Length = length;
- _maxLength = false;
- }
-
- public int Length { get; private set; }
-
- public override string FormatErrorMessage (string name)
- {
- return string.Format (ErrorMessageString, name, Length);
- }
-
- public override bool IsValid (object value)
- {
- // See: http://msdn.microsoft.com/en-us/library/gg696614.aspx
-
- if (this.Length == 0 || this.Length < -1)
- throw new InvalidOperationException (InvalidLengthErrorMessage);
-
- // Weird, but using 'MaxLength' with no length seems to be valid
- // and we should be returning true, and not throwing. (pablo)
- if (value != null && !_maxLength) {
-
- if (value is string) {
- return (value as string).Length <= this.Length;
- }
-
- if (value is Array) {
- return (value as Array).Length <= this.Length;
- }
-
- // NOTE: from my tests, MS.NET does not support IEnumerable as value. :(
- }
-
- return true;
- }
- }
-}
-
-#endif
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/MetadataTypeAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/MetadataTypeAttribute.cs
deleted file mode 100644
index 4fdae6c4c2a..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/MetadataTypeAttribute.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// MetadataTypeAttribute.cs
-//
-// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2008 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.ComponentModel;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsage (AttributeTargets.Class, AllowMultiple = false)]
- public sealed class MetadataTypeAttribute : Attribute
- {
- public MetadataTypeAttribute (Type metadataClassType)
- {
- MetadataClassType = metadataClassType;
- }
-
- public Type MetadataClassType { get; private set; }
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/MinLengthAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/MinLengthAttribute.cs
deleted file mode 100644
index ff30f7646d3..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/MinLengthAttribute.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-//
-// MinLengthAttribute.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-// Pablo Ruiz García <pablo.ruiz@gmail.com>
-//
-// Copyright (C) 2013 Xamarin Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_5
-
-using System;
-using System.Globalization;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsageAttribute (AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
- public class MinLengthAttribute : ValidationAttribute
- {
- private const string DefaultErrorMessage = "The field {0} must be a string or array type with a minimum length of '{1}'.";
- private const string InvalidLengthErrorMessage = "MinLengthAttribute must have a Length value that is zero or greater.";
-
- public MinLengthAttribute ()
- {
- }
-
- public MinLengthAttribute (int length)
- {
- Length = length;
- }
-
- public int Length { get; private set; }
-
- public override string FormatErrorMessage (string name)
- {
- return string.Format (ErrorMessageString, name, Length);
- }
-
- public override bool IsValid (object value)
- {
- if (this.Length < 0)
- throw new InvalidOperationException (InvalidLengthErrorMessage);
-
- if (value != null) {
-
- if (value is string) {
- return (value as string).Length >= this.Length;
- }
-
- if (value is Array) {
- return (value as Array).Length >= this.Length;
- }
-
- // NOTE: from my tests, MS.NET does not support IEnumerable as value. :(
- }
-
- return true;
- }
- }
-}
-
-#endif
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/PhoneAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/PhoneAttribute.cs
deleted file mode 100644
index 58cec3b6a4c..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/PhoneAttribute.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-//
-// PhoneAttribute.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-// Pablo Ruiz García <pablo.ruiz@gmail.com>
-//
-// Copyright (C) 2013 Xamarin Inc (http://www.xamarin.com)
-// Copyright (C) 2013 Pablo Ruiz García
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_5
-
-using System;
-using System.Globalization;
-using System.Text.RegularExpressions;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsageAttribute (AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
- public class PhoneAttribute : DataTypeAttribute
- {
- private const string DefaultErrorMessage = "The {0} field is not a valid phone number.";
- private const string _regexStr = @"^\+?(\d[\d-. ]+)?(\([\d-. ]+\))?[\d-. ]+\d$";
- private static Regex _regex = new Regex (_regexStr, RegexOptions.IgnoreCase | RegexOptions.Compiled);
-
- public PhoneAttribute ()
- : base(DataType.PhoneNumber)
- {
- // XXX: There is no .ctor accepting Func<string> on DataTypeAttribute.. :?
- base.ErrorMessage = DefaultErrorMessage;
- }
-
- public override bool IsValid(object value)
- {
- if (value == null)
- return true;
-
- if (value is string)
- {
- var str = value as string;
- return !string.IsNullOrEmpty(str) ? _regex.IsMatch(str) : false;
- }
-
- return false;
- }
- }
-}
-
-#endif
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/RangeAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/RangeAttribute.cs
deleted file mode 100644
index 9bf52669df9..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/RangeAttribute.cs
+++ /dev/null
@@ -1,191 +0,0 @@
-//
-// RangeAttribute.cs
-//
-// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2008 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Globalization;
-using System.ComponentModel;
-
-namespace System.ComponentModel.DataAnnotations
-{
-#if NET_4_0
- [AttributeUsage (AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
-#else
- [AttributeUsage (AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false)]
-#endif
- public class RangeAttribute : ValidationAttribute
- {
- Func <object, bool> comparer;
- TypeConverter cvt;
-
- public object Maximum { get; private set; }
- public object Minimum { get; private set; }
- public Type OperandType { get; private set; }
-
- IComparable MaximumComparable {
- get { return Maximum as IComparable; }
- }
-
- IComparable MinimumComparable {
- get { return Minimum as IComparable; }
- }
-
- RangeAttribute ()
- : base (GetDefaultErrorMessage)
- {
- }
-
- public RangeAttribute (double minimum, double maximum) : this ()
- {
- Minimum = minimum;
- Maximum = maximum;
- OperandType = typeof (double);
- }
-
- public RangeAttribute (int minimum, int maximum) : this ()
- {
- Minimum = minimum;
- Maximum = maximum;
- OperandType = typeof (int);
- }
-
- public RangeAttribute (Type type, string minimum, string maximum) : this ()
- {
-#if !NET_4_0
- if (type == null)
- throw new ArgumentNullException ("type");
-#endif
- OperandType = type;
- Minimum = minimum;
- Maximum = maximum;
-#if !NET_4_0
- comparer = SetupComparer ();
-#endif
- }
-
- static string GetDefaultErrorMessage ()
- {
- return "The field {0} must be between {1} and {2}.";
- }
-
- public override string FormatErrorMessage (string name)
- {
- if (comparer == null)
- comparer = SetupComparer ();
-
- return String.Format (ErrorMessageString, name, Minimum, Maximum);
- }
-
- // LAMESPEC: does not throw ValidationException when value is out of range
- public override bool IsValid (object value)
- {
- if (comparer == null)
- comparer = SetupComparer ();
-
- if (value == null)
- return true;
-
- string s = value as string;
- if (s != null && s.Length == 0)
- return true;
-
- try {
- if (comparer != null)
- return comparer (value);
-
- return false;
- } catch (FormatException) {
- return false;
- } catch (InvalidCastException) {
- return false;
- }
- }
-
- Func <object, bool> SetupComparer ()
- {
- Type ot = OperandType;
-
- object min = Minimum, max = Maximum;
-#if NET_4_0
- if (min == null || max == null)
- throw new InvalidOperationException ("The minimum and maximum values must be set.");
-#endif
- if (min is int)
- return new Func <object, bool> (CompareInt);
-
- if (min is double)
- return new Func <object, bool> (CompareDouble);
-
- if (ot == null)
- throw new InvalidOperationException ("The OperandType must be set when strings are used for minimum and maximum values.");
-
- if (!typeof(IComparable).IsAssignableFrom (ot)) {
-#if NET_4_0
- string message = String.Format ("The type {0} must implement System.IComparable", ot.FullName);
- throw new InvalidOperationException (message);
-#else
- throw new ArgumentException ("object");
-#endif
- }
-
- string smin = min as string, smax = max as string;
- cvt = TypeDescriptor.GetConverter (ot);
- Minimum = cvt.ConvertFromString (smin);
- Maximum = cvt.ConvertFromString (smax);
-
- return new Func <object, bool> (CompareArbitrary);
- }
-
- bool CompareInt (object value)
- {
- int cv = Convert.ToInt32 (value);
-
- return MinimumComparable.CompareTo (cv) <= 0 && MaximumComparable.CompareTo (cv) >= 0;
- }
-
- bool CompareDouble (object value)
- {
- double cv = Convert.ToDouble (value);
-
- return MinimumComparable.CompareTo (cv) <= 0 && MaximumComparable.CompareTo (cv) >= 0;
- }
-
- bool CompareArbitrary (object value)
- {
- object cv;
- if (value != null && value.GetType () == OperandType)
- cv = value;
- else if (cvt != null)
- cv = cvt.ConvertFrom (value);
- else
- cv = null;
-
- return MinimumComparable.CompareTo (cv) <= 0 && MaximumComparable.CompareTo (cv) >= 0;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/RegularExpressionAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/RegularExpressionAttribute.cs
deleted file mode 100644
index d4d304171f5..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/RegularExpressionAttribute.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-// RegularExpressionAttribute.cs
-//
-// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
-// Antoine Cailliau <a.cailliau@maximux.net>
-//
-// Copyright (C) 2008 Novell Inc. http://novell.com
-// Copyright (C) 20011 Maximux Scris. http://maximux.net
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Globalization;
-using System.ComponentModel;
-using System.Text.RegularExpressions;
-
-namespace System.ComponentModel.DataAnnotations
-{
-
-#if NET_4_0
- [AttributeUsage (AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter, AllowMultiple = false)]
-#else
- [AttributeUsage (AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false)]
-#endif
- public class RegularExpressionAttribute : ValidationAttribute
- {
- public RegularExpressionAttribute (string pattern)
- : base(GetDefaultErrorMessage)
- {
- if (pattern == null)
- throw new ArgumentNullException("pattern");
- Pattern = pattern;
- }
-
- public string Pattern { get; private set; }
-
- static string GetDefaultErrorMessage ()
- {
- return "The field {0} must match the regular expression {1}.";
- }
-
- public override string FormatErrorMessage (string name)
- {
- return string.Format (ErrorMessageString, name, Pattern);
- }
-
- // LAMESPEC: does not throw ValidationException when value does not match the regular expression
- public override bool IsValid (object value)
- {
- if (value == null)
- return true;
-
- string str = (string) value;
- Regex regex = new Regex(Pattern);
- return regex.IsMatch(str);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/RequiredAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/RequiredAttribute.cs
deleted file mode 100644
index da77782eb29..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/RequiredAttribute.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// RequiredAttribute.cs
-//
-// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2008-2010 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.ComponentModel;
-
-namespace System.ComponentModel.DataAnnotations
-{
-#if NET_4_0
- [AttributeUsage (AttributeTargets.Parameter|AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false)]
-#else
- [AttributeUsage (AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false)]
-#endif
- public class RequiredAttribute : ValidationAttribute
- {
-#if NET_4_0
- public bool AllowEmptyStrings { get; set; }
-#endif
-
- public override bool IsValid (object value)
- {
- if (value == null)
- return false;
-
- string s = value as string;
- if (s != null
-#if NET_4_0
- && !AllowEmptyStrings
-#endif
- )
- return s.Length > 0;
-
- return true;
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ScaffoldColumnAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ScaffoldColumnAttribute.cs
deleted file mode 100644
index c893658625f..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ScaffoldColumnAttribute.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// RequiredAttribute.cs
-//
-// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2008 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.ComponentModel;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsage (AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false)]
- public class ScaffoldColumnAttribute : Attribute
- {
- public ScaffoldColumnAttribute (bool scaffold)
- {
- Scaffold = scaffold;
- }
-
- [MonoTODO]
- public bool Scaffold { get; private set; }
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ScaffoldTableAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ScaffoldTableAttribute.cs
deleted file mode 100644
index 505f775ebdc..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ScaffoldTableAttribute.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// RequiredAttribute.cs
-//
-// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2008 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.ComponentModel;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsage (AttributeTargets.Class, AllowMultiple = false)]
- public class ScaffoldTableAttribute : Attribute
- {
- public ScaffoldTableAttribute (bool scaffold)
- {
- Scaffold = scaffold;
- }
-
- [MonoTODO]
- public bool Scaffold { get; private set; }
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/StringLengthAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/StringLengthAttribute.cs
deleted file mode 100644
index 20a59e74abc..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/StringLengthAttribute.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-// StringLengthAttribute.cs
-//
-// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
-// Marek Habersack <grendel@twistedcode.net>
-//
-// Copyright (C) 2008-2010 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Globalization;
-using System.ComponentModel;
-
-namespace System.ComponentModel.DataAnnotations
-{
-#if NET_4_0
- [AttributeUsage (AttributeTargets.Parameter|AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false)]
-#else
- [AttributeUsage (AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false)]
-#endif
- public class StringLengthAttribute : ValidationAttribute
- {
- public int MaximumLength { get; private set; }
-#if NET_4_0
- public int MinimumLength { get; set; }
-#endif
- public StringLengthAttribute (int maximumLength)
- : base (GetDefaultErrorMessage)
- {
-#if !NET_4_0
- if (maximumLength < 0)
- throw new ArgumentOutOfRangeException ("maximumLength", String.Format ("Actual value was {0}", maximumLength));
-#endif
- MaximumLength = maximumLength;
- }
-
- static string GetDefaultErrorMessage ()
- {
- return "The field {0} must be a string with a maximum length of {1}.";
- }
-
- public override string FormatErrorMessage (string name)
- {
-#if NET_4_0
- return String.Format (ErrorMessageString, name, MaximumLength, MinimumLength);
-#else
- return String.Format (ErrorMessageString, name, MaximumLength);
-#endif
- }
-
- public override bool IsValid (object value)
- {
- if (value == null)
- return true;
-
- string str = (string)value;
- int max = MaximumLength;
-#if NET_4_0
- int min = MinimumLength;
-
- // LAMESPEC: documented to throw ArgumentOutOfRangeException
- if (max < 0)
- throw new InvalidOperationException ("The maximum length must be a nonnegative integer.");
-
- if (min > max)
- throw new InvalidOperationException (
- String.Format ("The maximum value '{0}' must be greater than or equal to the minimum value '{1}'.",
- max, min)
- );
-
- int len = str.Length;
- return len <= max && len >= min;
-#else
- return str.Length <= max;
-#endif
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/TimestampAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/TimestampAttribute.cs
deleted file mode 100644
index 4d67b9c49b4..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/TimestampAttribute.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// TimestampAttribute.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-// Pablo Ruiz García <pablo.ruiz@gmail.com>
-//
-// Copyright (C) 2013 Xamarin Inc (http://www.xamarin.com)
-// Copyright (C) 2013 Pablo Ruiz García
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_0
-
-using System;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsageAttribute (AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
- public class TimestampAttribute : Attribute
- {
- }
-}
-
-#endif
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/UIHintAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/UIHintAttribute.cs
deleted file mode 100644
index ec6e1159277..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/UIHintAttribute.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-//
-// UIHintAttribute.cs
-//
-// Authors:
-// Atsushi Enomoto <atsushi@ximian.com>
-// Marek Safar <marek.safar@gmail.com>
-//
-// Copyright (C) 2008 Novell Inc. http://novell.com
-// Copyright (C) 2013 Xamarin Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Runtime.CompilerServices;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsage (AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = true)]
- public class UIHintAttribute : Attribute
- {
- readonly ControlParameters controlParameters;
-
- public UIHintAttribute (string uiHint)
- : this (uiHint, null)
- {
- }
-
- public UIHintAttribute (string uiHint, string presentationLayer)
- : this (uiHint, presentationLayer, null)
- {
- }
-
- public UIHintAttribute (string uiHint, string presentationLayer, params object [] controlParameters)
- {
- UIHint = uiHint;
- PresentationLayer = presentationLayer;
- this.controlParameters = new ControlParameters (controlParameters);
- }
-
- public IDictionary<string, object> ControlParameters {
- get {
- return controlParameters.Dictionary;
- }
- }
-
- public string PresentationLayer { get; private set; }
-
- public string UIHint { get; private set; }
-
-#if NET_4_0
- public override object TypeId {
- get {
- return this;
- }
- }
-#endif
-
- public override int GetHashCode ()
- {
- return RuntimeHelpers.GetHashCode (UIHint) ^
- RuntimeHelpers.GetHashCode (PresentationLayer);
- }
-
- public override bool Equals (object obj)
- {
- var ha = obj as UIHintAttribute;
- if (ha == null)
- return false;
-
- return ha.UIHint == UIHint &&
- ha.PresentationLayer == PresentationLayer &&
- ha.controlParameters.Equals (controlParameters);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/UrlAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/UrlAttribute.cs
deleted file mode 100644
index 4fa0dec8218..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/UrlAttribute.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// UrlAttribute.cs
-//
-// Authors:
-// Marek Safar <marek.safar@gmail.com>
-//
-// Copyright (C) 2014 Xamarin Inc (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_4_5
-
-namespace System.ComponentModel.DataAnnotations
-{
- [AttributeUsageAttribute (AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
- public sealed class UrlAttribute : DataTypeAttribute
- {
- public UrlAttribute ()
- : base (DataType.Url)
- {
- }
-
- public override bool IsValid (object value)
- {
- if (value == null)
- return true;
-
- var s = value as string;
- return s != null && Uri.IsWellFormedUriString (s, UriKind.Absolute);
- }
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationAttribute.cs
deleted file mode 100644
index d95ff90b3a5..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationAttribute.cs
+++ /dev/null
@@ -1,270 +0,0 @@
-//
-// ValidationAttribute.cs
-//
-// Authors:
-// Atsushi Enomoto <atsushi@ximian.com>
-// Marek Habersack <mhabersack@novell.com>
-//
-// Copyright (C) 2008-2010 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.ComponentModel;
-using System.Reflection;
-using System.Globalization;
-
-namespace System.ComponentModel.DataAnnotations
-{
- public abstract class ValidationAttribute : Attribute
- {
- const string DEFAULT_ERROR_MESSAGE = "The field {0} is invalid.";
-#if NET_4_0
- object nestedCallLock = new object ();
- bool nestedCall;
-#else
- string errorMessageResourceName;
- string errorMessageString;
- Type errorMessageResourceType;
-#endif
- string errorMessage;
- string fallbackErrorMessage;
- Func <string> errorMessageAccessor;
-
- protected ValidationAttribute ()
- {
- }
-
- protected ValidationAttribute (Func<string> errorMessageAccessor)
- {
- this.errorMessageAccessor = errorMessageAccessor;
- }
-
- protected ValidationAttribute (string errorMessage)
- {
- fallbackErrorMessage = errorMessage;
- }
-
- public virtual string FormatErrorMessage (string name)
- {
- string format = ErrorMessageString;
- if (String.IsNullOrEmpty (format))
- return String.Empty;
-
- return String.Format (ErrorMessageString, name);
- }
-#if NET_4_0
- public string ErrorMessage {
- get { return errorMessage; }
- set {
- errorMessage = value;
- if (errorMessage != null)
- errorMessageAccessor = null;
- }
- }
- public string ErrorMessageResourceName { get; set; }
- public Type ErrorMessageResourceType { get; set; }
-#else
- public string ErrorMessage {
- get { return errorMessage; }
-
- set {
-#if !NET_4_0
- if (errorMessage != null)
- throw new InvalidOperationException ("This property can be set only once.");
-#endif
- if (String.IsNullOrEmpty (value))
- throw new ArgumentException ("Value cannot be null or empty.", "value");
-
- if (errorMessageResourceName != null || errorMessageResourceType != null)
- throw new InvalidOperationException ("This property cannot be set because the attribute is already in the resource mode.");
-
- errorMessage = value;
- }
- }
-
- public string ErrorMessageResourceName {
- get { return errorMessageResourceName; }
-
- set {
- if (errorMessageResourceName != null)
- throw new InvalidOperationException ("This property can be set only once.");
-
- if (String.IsNullOrEmpty (value))
- throw new ArgumentException ("Value cannot be null or empty.", "value");
-
- errorMessageResourceName = value;
- if (errorMessageResourceType != null)
- errorMessageString = GetStringFromResourceAccessor ();
- }
- }
-
- public Type ErrorMessageResourceType {
- get { return errorMessageResourceType; }
- set {
- errorMessageResourceType = value;
- if (!String.IsNullOrEmpty (errorMessageResourceName))
- errorMessageString = GetStringFromResourceAccessor ();
- }
- }
-#endif
- protected string ErrorMessageString {
- get { return GetStringFromResourceAccessor (); }
- }
-
-#if NET_4_5
- // See: http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.validationattribute.requiresvalidationcontext.aspx
- public virtual bool RequiresValidationContext { get { return false; } }
-#endif
-
-#if NET_4_0
- NotImplementedException NestedNIEX ()
- {
- return new NotImplementedException ("IsValid(object value) has not been implemented by this class. The preferred entry point is GetValidationResult() and classes should override IsValid(object value, ValidationContext context).");
- }
-
- //
- // This is the weirdest (to be gentle) idea ever... The IsValid (object) overload
- // throws the NIEX when it is called from the default IsValid (object,
- // ValidationContext) overload, but not when directly. And the reverse situation is
- // true as well. That means, the calls detect the "nested" calls and that we need to
- // protect the nestedCall flag... ugh
- //
- public virtual bool IsValid (object value)
- {
- lock (nestedCallLock) {
- if (nestedCall)
- throw NestedNIEX ();
- try {
- nestedCall = true;
- return IsValid (value, null) == ValidationResult.Success;
- } finally {
- nestedCall = false;
- }
- }
- }
-
- protected virtual ValidationResult IsValid (object value, ValidationContext validationContext)
- {
- lock (nestedCallLock) {
- if (nestedCall)
- throw NestedNIEX ();
-
- try {
- nestedCall = true;
- if (!IsValid (value)) {
- // .NET emulation
- if (validationContext == null)
- throw new NullReferenceException (".NET emulation.");
- string memberName = validationContext.MemberName;
- return new ValidationResult (FormatErrorMessage (validationContext.DisplayName), memberName != null ? new string[] { memberName } : new string[] {});
- }
- } finally {
- nestedCall = false;
- }
- }
-
- return ValidationResult.Success;
- }
-#else
- public abstract bool IsValid (object value);
-#endif
-
-#if NET_4_0
- public ValidationResult GetValidationResult (object value, ValidationContext validationContext)
- {
- if (validationContext == null)
- throw new ArgumentNullException ("validationContext");
-
- ValidationResult ret = IsValid (value, validationContext);
- if (ret != null && String.IsNullOrEmpty (ret.ErrorMessage))
- ret.ErrorMessage = FormatErrorMessage (validationContext.DisplayName);
-
- return ret;
- }
-#endif
- string GetStringFromResourceAccessor ()
- {
- string resourceName = ErrorMessageResourceName;
- Type resourceType = ErrorMessageResourceType;
- string errorMessage = ErrorMessage;
-
- if (resourceName != null && errorMessage != null)
- throw new InvalidOperationException ("Either ErrorMessage or ErrorMessageResourceName must be set, but not both.");
-
- if (resourceType == null ^ resourceName == null)
- throw new InvalidOperationException ("Both ErrorMessageResourceType and ErrorMessageResourceName must be set on this attribute.");
-
-
-
- if (resourceType != null) {
- PropertyInfo pi = resourceType.GetProperty (resourceName, BindingFlags.Public | BindingFlags.Static);
- if (pi == null || !pi.CanRead)
- throw new InvalidOperationException (
- String.Format ("Resource type '{0}' does not have an accessible static property named '{1}'.",
- resourceType, resourceName)
- );
-
- if (pi.PropertyType != typeof (string))
- throw new InvalidOperationException (
- String.Format ("The property '{0}' on resource type '{1}' is not a string type.",
- resourceName, resourceType)
- );
-
- return pi.GetValue (null, null) as string;
- }
-
- if (errorMessage == null) {
- if (errorMessageAccessor != null)
- return errorMessageAccessor ();
-
- if (fallbackErrorMessage != null)
- return fallbackErrorMessage;
- else
- return DEFAULT_ERROR_MESSAGE;
- }
-
- return errorMessage;
- }
-#if NET_4_0
- public void Validate (object value, ValidationContext validationContext)
- {
- if (validationContext == null)
- throw new ArgumentNullException ("validationContext");
-
- ValidationResult result = IsValid (value, validationContext);
- if (result != null) {
- string message = result.ErrorMessage;
- if (message == null)
- message = FormatErrorMessage (validationContext.DisplayName);
-
- throw new ValidationException (message, this, value);
- }
- }
-#endif
- public void Validate (object value, string name)
- {
- if (!IsValid (value))
- throw new ValidationException (FormatErrorMessage (name), this, value);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationAttributeCollectionExtensions.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationAttributeCollectionExtensions.cs
deleted file mode 100644
index 9dec3195cb7..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationAttributeCollectionExtensions.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-//
-// Authors:
-// Marek Habersack <grendel@twistedcode.net>
-//
-// Copyright (C) 2011 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Reflection;
-
-namespace System.ComponentModel.DataAnnotations
-{
- static class ValidationAttributeCollectionExtensions
- {
- public static void Validate <TAttribute> (this AttributeCollection attributes, object value, ValidationContext validationContext,
- ICollection <ValidationResult> validationResults, ref bool valid)
- where TAttribute: ValidationAttribute
- {
- if (attributes == null || attributes == AttributeCollection.Empty || attributes.Count <= 0)
- return;
-
- ValidationResult result;
- foreach (TAttribute attr in attributes.OfType <TAttribute> ()) {
- result = attr.GetValidationResult (value, validationContext);
- if (result != ValidationResult.Success) {
- valid = false;
- if (validationResults != null)
- validationResults.Add (result);
- }
- }
- }
-
- public static void ValidateExcept <TAttribute> (this AttributeCollection attributes, object value, ValidationContext validationContext,
- ICollection <ValidationResult> validationResults, ref bool valid)
- where TAttribute: ValidationAttribute
- {
- if (attributes == null || attributes == AttributeCollection.Empty || attributes.Count <= 0)
- return;
-
- ValidationResult result;
- ValidationAttribute vattr;
- foreach (Attribute attr in attributes) {
- if (attr is TAttribute)
- continue;
- vattr = attr as ValidationAttribute;
- if (vattr == null)
- continue;
-
- result = vattr.GetValidationResult (value, validationContext);
- if (result != ValidationResult.Success) {
- valid = false;
- if (validationResults != null)
- validationResults.Add (result);
- }
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationContext.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationContext.cs
deleted file mode 100644
index f39c4a42324..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationContext.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-//
-// ValidationContext.cs
-//
-// Authors:
-// Marek Habersack <mhabersack@novell.com>
-//
-// Copyright (C) 2010 Novell Inc. (http://novell.com)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Design;
-
-namespace System.ComponentModel.DataAnnotations
-{
- public sealed class ValidationContext : IServiceProvider
- {
- public string DisplayName { get; set; }
- public IDictionary <object, object> Items { get; private set; }
- public string MemberName { get; set; }
- public object ObjectInstance { get; private set; }
- public Type ObjectType { get; private set; }
- public IServiceContainer ServiceContainer { get; private set; }
-
- public ValidationContext (object instance, IServiceProvider serviceProvider, IDictionary<object, object> items)
- {
- if (instance == null)
- throw new ArgumentNullException ("instance");
-
- ObjectInstance = instance;
- ObjectType = instance.GetType ();
- if (items != null)
- Items = new Dictionary <object, object> (items);
- else
- Items = new Dictionary <object, object> ();
-
- DisplayName = instance.GetType ().Name;
-
- // LAMESPEC: MSDN says vc.ServiceContainer should be initialized with the passed container if it implements
- // the IServiceContainer interface - not the case, though.
- //
- // IServiceContainer container = serviceProvider as IServiceContainer;
- // if (container != null)
- // ServiceContainer = container;
- // else
- ServiceContainer = new ValidationContextServiceContainer ();
- }
-
-#if NET_4_5
- public ValidationContext (object instance)
- : this (instance, null, null)
- {
- }
-
- public ValidationContext (object instance, IDictionary<object, object> items)
- : this (instance, null, items)
- {
- }
-
- // FIXME: According to MSDN, this should be defined in
- // 4.5, Silverlight and PCL
- [MonoTODO]
- public void InitializeServiceProvider (
- Func<Type, Object> serviceProvider)
- {
- throw new NotImplementedException ();
- }
-#endif
-
- public object GetService (Type serviceType)
- {
- return ServiceContainer.GetService (serviceType);
- }
-
- sealed class ValidationContextServiceContainer : IServiceContainer
- {
- Dictionary <Type, object> services = new Dictionary <Type, object> ();
-
- public void AddService (Type serviceType, ServiceCreatorCallback callback, bool promote)
- {
- AddService (serviceType, (object)callback, promote);
- }
-
- public void AddService (Type serviceType, ServiceCreatorCallback callback)
- {
- AddService (serviceType, callback, false);
- }
-
- public void AddService (Type serviceType, object serviceInstance, bool promote)
- {
- if (serviceType == null)
- throw new ArgumentNullException ("serviceType");
-
- if (services.ContainsKey (serviceType))
- throw new ArgumentException (
- String.Format ("A service of type '{0}' already exists in the container.", serviceType)
- );
-
- services.Add (serviceType, serviceInstance);
- }
-
- public void AddService (Type serviceType, object serviceInstance)
- {
- AddService (serviceType, serviceInstance, false);
- }
-
- public void RemoveService (Type serviceType, bool promote)
- {
- if (serviceType == null)
- throw new ArgumentNullException ("serviceType");
-
- if (!services.ContainsKey (serviceType))
- return;
-
- services.Remove (serviceType);
- }
-
- public void RemoveService (Type serviceType)
- {
- RemoveService (serviceType, false);
- }
-
- public object GetService (Type serviceType)
- {
- if (serviceType == null)
- throw new ArgumentNullException ("serviceType");
-
- object o;
- if (!services.TryGetValue (serviceType, out o))
- return null;
-
- var cb = o as ServiceCreatorCallback;
- if (cb != null)
- return cb (this, serviceType);
-
- return o;
- }
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationException.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationException.cs
deleted file mode 100644
index f12507a52a5..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationException.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-//
-// ValidationException.cs
-//
-// Author:
-// Atsushi Enomoto <atsushi@ximian.com>
-//
-// Copyright (C) 2008-2011 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.ComponentModel;
-using System.Runtime.Serialization;
-using System.Security.Permissions;
-
-namespace System.ComponentModel.DataAnnotations
-{
- [Serializable]
- public class ValidationException : Exception
- {
- public ValidationException ()
- {
- }
- public ValidationException (string message)
- : base (message)
- {
- }
- public ValidationException (string message, Exception innerException)
- : base (message, innerException)
- {
- }
-
- public ValidationException (string errorMessage, ValidationAttribute validatingAttribute, object value)
- : base (errorMessage)
- {
- ValidationAttribute = validatingAttribute;
- Value = value;
- }
-
- protected ValidationException (SerializationInfo info, StreamingContext context)
- : base (info, context)
- {
- throw new NotImplementedException ();
- }
-#if NET_4_0
- public ValidationException (ValidationResult validationResult, ValidationAttribute validatingAttribute, object value)
- : this (validationResult != null ? validationResult.ErrorMessage : null, validatingAttribute, value)
- {
- this.ValidationResult = validationResult;
- }
-
- public ValidationResult ValidationResult { get; private set; }
-#endif
- public ValidationAttribute ValidationAttribute { get; private set; }
- public object Value { get; private set; }
-
-#if !NET_4_5
- [SecurityPermission (SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
- public override void GetObjectData (SerializationInfo info, StreamingContext context)
- {
- throw new NotImplementedException ();
- }
-#endif
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationResult.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationResult.cs
deleted file mode 100644
index 50afd2182c1..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/ValidationResult.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-//
-// ValidationResult.cs
-//
-// Authors:
-// Marek Habersack <mhabersack@novell.com>
-//
-// Copyright (C) 2010 Novell Inc. (http://novell.com)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Collections.Generic;
-
-namespace System.ComponentModel.DataAnnotations
-{
- public class ValidationResult
- {
- public static readonly ValidationResult Success = null; // it is supposed to be null
-
- public string ErrorMessage { get; set; }
- public IEnumerable<string> MemberNames { get; private set; }
-
- public ValidationResult (string errorMessage)
- : this (errorMessage, new string[] {})
-
- {
- }
-
- protected ValidationResult (ValidationResult validationResult)
- {
- }
-
- public ValidationResult (string errorMessage, IEnumerable<string> memberNames)
- {
- ErrorMessage = errorMessage;
- if (memberNames != null)
- MemberNames = memberNames;
- else
- MemberNames = new string[] {};
- }
-
-#if NET_4_5
- public override string ToString ()
- {
- // See: http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.validationresult.tostring.aspx
- if (!string.IsNullOrEmpty (ErrorMessage))
- return ErrorMessage;
-
- return base.ToString ();
- }
-#endif
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/Validator.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/Validator.cs
deleted file mode 100644
index 18f98fe2bf7..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/Validator.cs
+++ /dev/null
@@ -1,206 +0,0 @@
-//
-// Authors:
-// Marek Habersack <grendel@twistedcode.net>
-//
-// Copyright (C) 2011 Novell Inc. http://novell.com
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Reflection;
-
-namespace System.ComponentModel.DataAnnotations
-{
- // TODO: we could probably use some kind of type cache here
- public static class Validator
- {
- public static bool TryValidateObject (object instance, ValidationContext validationContext, ICollection <ValidationResult> validationResults)
- {
- return TryValidateObject (instance, validationContext, validationResults, false);
- }
-
- public static bool TryValidateObject (object instance, ValidationContext validationContext, ICollection <ValidationResult> validationResults, bool validateAllProperties)
- {
- if (instance == null)
- throw new ArgumentNullException ("instance");
-
- if (validationContext == null)
- throw new ArgumentNullException ("validationContext");
-
- if (!Object.ReferenceEquals (instance, validationContext.ObjectInstance))
- throw new ArgumentException ("The instance provided must match the ObjectInstance on the ValidationContext supplied.", "instance");
-
- bool valid = true;
- Type instanceType = instance.GetType ();
- TypeDescriptor.GetAttributes (instanceType).Validate <ValidationAttribute> (instance, validationContext, validationResults, ref valid);
-
- PropertyDescriptorCollection properties = TypeDescriptor.GetProperties (instance);
- if (properties != PropertyDescriptorCollection.Empty && properties.Count > 0) {
- foreach (PropertyDescriptor pdesc in properties) {
- object value = pdesc.GetValue (instance);
- ValidateProperty (pdesc, value, validationContext, validationResults, validateAllProperties, ref valid);
- }
- }
-
- return valid;
- }
-
- static void ValidateProperty (PropertyDescriptor pdesc, object value, ValidationContext validationContext, ICollection <ValidationResult> validationResults,
- bool validateAll, ref bool valid)
- {
- AttributeCollection attributes = pdesc.Attributes;
- attributes.Validate <RequiredAttribute> (value, validationContext, validationResults, ref valid);
- if (validateAll)
- attributes.ValidateExcept <RequiredAttribute> (value, validationContext, validationResults, ref valid);
- }
-
- static PropertyDescriptor GetProperty (Type type, string propertyName, object value)
- {
- if (String.IsNullOrEmpty (propertyName))
- throw new ArgumentNullException ("propertyName");
-
- PropertyDescriptorCollection properties = TypeDescriptor.GetProperties (type);
- PropertyDescriptor pdesc = null;
- if (properties != PropertyDescriptorCollection.Empty && properties.Count > 0)
- pdesc = properties.Find (propertyName, false);
-
- if (pdesc == null)
- throw new ArgumentException (String.Format ("The type '{0}' does not contain a public property named '{1}'.", type.Name, propertyName), "propertyName");
-
- Type valueType = value == null ? null : value.GetType ();
- Type propertyType = pdesc.PropertyType;
- bool invalidType = false;
-
- if (valueType == null)
- invalidType = (propertyType.IsValueType && Nullable.GetUnderlyingType(propertyType) == null);
- else
- invalidType = !propertyType.IsAssignableFrom(valueType);
-
- if (invalidType)
- throw new ArgumentException (String.Format ("The value of property '{0}' must be of type '{1}'.", propertyName, propertyType.FullName), "propertyName");
-
- return pdesc;
- }
-
- public static bool TryValidateProperty (object value, ValidationContext validationContext, ICollection <ValidationResult> validationResults)
- {
- // LAMESPEC: value can be null, validationContext must not
- if (validationContext == null)
- throw new ArgumentNullException ("validationContext");
-
- PropertyDescriptor pdesc = GetProperty (validationContext.ObjectType, validationContext.MemberName, value);
-
- bool valid = true;
- ValidateProperty (pdesc, value, validationContext, validationResults, true, ref valid);
-
- return valid;
- }
-
- public static bool TryValidateValue (object value, ValidationContext validationContext, ICollection<ValidationResult> validationResults,
- IEnumerable <ValidationAttribute> validationAttributes)
- {
- if (validationContext == null)
- throw new ArgumentNullException ("validationContext");
-
- ValidationResult result;
-
- // It appears .NET makes this call before checking whether
- // validationAttributes is null...
- ValidationAttribute vattr = validationAttributes.FirstOrDefault <ValidationAttribute> (attr => attr is RequiredAttribute);
- if (vattr != null) {
- result = vattr.GetValidationResult (value, validationContext);
- if (result != ValidationResult.Success) {
- if (validationResults != null)
- validationResults.Add (result);
- return false;
- }
- }
-
- if (validationAttributes == null)
- return true;
-
- bool valid = true;
- foreach (ValidationAttribute attr in validationAttributes) {
- if (attr == null || (attr is RequiredAttribute))
- continue;
-
- result = attr.GetValidationResult (value, validationContext);
- if (result != ValidationResult.Success) {
- valid = false;
- if (validationResults != null)
- validationResults.Add (result);
- }
- }
-
- return valid;
- }
-
- public static void ValidateObject (object instance, ValidationContext validationContext)
- {
- ValidateObject (instance, validationContext, false);
- }
-
- public static void ValidateObject (object instance, ValidationContext validationContext, bool validateAllProperties)
- {
- if (instance == null)
- throw new ArgumentNullException ("instance");
- if (validationContext == null)
- throw new ArgumentNullException ("validationContext");
-
- var validationResults = new List <ValidationResult> ();
- if (TryValidateObject (instance, validationContext, validationResults, validateAllProperties))
- return;
-
- ValidationResult result = validationResults.Count > 0 ? validationResults [0] : null;
- throw new ValidationException (result, null, instance);
- }
-
- public static void ValidateProperty (object value, ValidationContext validationContext)
- {
- if (validationContext == null)
- throw new ArgumentNullException ("validationContext");
-
- var validationResults = new List <ValidationResult> ();
- if (TryValidateProperty (value, validationContext, validationResults))
- return;
-
- ValidationResult result = validationResults.Count > 0 ? validationResults [0] : null;
- throw new ValidationException (result, null, value);
- }
-
- public static void ValidateValue (object value, ValidationContext validationContext, IEnumerable <ValidationAttribute> validationAttributes)
- {
- if (validationContext == null)
- throw new ArgumentNullException ("validationContext");
-
- var validationResults = new List <ValidationResult> ();
- if (TryValidateValue (value, validationContext, validationResults, validationAttributes))
- return;
-
- ValidationResult result = validationResults.Count > 0 ? validationResults [0] : null;
- throw new ValidationException (result, null, value);
- }
- }
-}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CreditCardAttributeTest.cs b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CreditCardAttributeTest.cs
index 67ed9dac283..846ee326176 100644
--- a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CreditCardAttributeTest.cs
+++ b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/CreditCardAttributeTest.cs
@@ -46,14 +46,12 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
var sla = new CreditCardAttribute ();
Assert.IsTrue (sla.IsValid (null), "#A1-1");
- Assert.IsFalse (sla.IsValid (String.Empty), "#A1-2");
+ Assert.IsTrue (sla.IsValid (String.Empty), "#A1-2");
Assert.IsFalse (sla.IsValid ("string"), "#A1-3");
Assert.IsTrue (sla.IsValid ("378282246310005"), "#A1-4");
Assert.IsTrue (sla.IsValid ("3782-8224-6310-005"), "#A1-5");
Assert.IsTrue (sla.IsValid ("371449635398431"), "#A-6");
-#if false
Assert.IsFalse (sla.IsValid ("371449635498431"), "#A-6b");
-#endif
Assert.IsFalse (sla.IsValid (true), "#A1-7");
Assert.IsFalse (sla.IsValid (DateTime.Now), "#A1-8");
}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/DisplayAttributeTest.cs b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/DisplayAttributeTest.cs
index 0753fde5a69..3d54000c5dd 100644
--- a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/DisplayAttributeTest.cs
+++ b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/DisplayAttributeTest.cs
@@ -71,7 +71,7 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
public class DisplayAttributeTests
{
const string property_not_set_message = "The {0} property has not been set. Use the Get{0} method to get the value.";
- const string localization_failed_message = "Cannot retrieve property '{0}' because localization failed. Type '{1} is not public or does not contain a public static string property with the name '{2}'.";
+ const string localization_failed_message = "Cannot retrieve property '{0}' because localization failed. Type '{1}' is not public or does not contain a public static string property with the name '{2}'.";
[Test]
public void StringProperties_ReturnLiteralValues_Success()
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/EmailAddressAttributeTest.cs b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/EmailAddressAttributeTest.cs
index 09350cde8fd..552e3eae6a4 100644
--- a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/EmailAddressAttributeTest.cs
+++ b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/EmailAddressAttributeTest.cs
@@ -50,11 +50,6 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
"$A12345@example.com",
"!def!xyz%abc@example.com",
"_somename@example.com",
- "valid.ipv4.addr@[123.1.72.10]",
- "valid.ipv6.addr@[IPv6:0::1]",
- "valid.ipv6.addr@[IPv6:2607:f0d0:1002:51::4]",
- "valid.ipv6.addr@[IPv6:fe80::230:48ff:fe33:bc33]",
- "valid.ipv6v4.addr@[IPv6:aaaa:aaaa:aaaa:aaaa:aaaa:aaaa:127.0.0.1]",
};
static readonly object[] InvalidAddresses = new object[] {
@@ -69,6 +64,12 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
"invalid@[127.0.0.1.]",
"invalid@[127.0.0.1].",
"invalid@[127.0.0.1]x",
+
+ "valid.ipv4.addr@[123.1.72.10]",
+ "valid.ipv6.addr@[IPv6:0::1]",
+ "valid.ipv6.addr@[IPv6:2607:f0d0:1002:51::4]",
+ "valid.ipv6.addr@[IPv6:fe80::230:48ff:fe33:bc33]",
+ "valid.ipv6v4.addr@[IPv6:aaaa:aaaa:aaaa:aaaa:aaaa:aaaa:127.0.0.1]",
};
[Test]
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/RegularExpressionAttributeTest.cs b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/RegularExpressionAttributeTest.cs
index 65778396502..163e1a738b7 100644
--- a/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/RegularExpressionAttributeTest.cs
+++ b/mcs/class/System.ComponentModel.DataAnnotations/Test/System.ComponentModel.DataAnnotations/RegularExpressionAttributeTest.cs
@@ -90,26 +90,29 @@ namespace MonoTests.System.ComponentModel.DataAnnotations
Assert.IsTrue (rea.IsValid (null), "Null does not match [A-Za-z].");
Assert.IsTrue (rea.IsValid ("A"), "'A' does not match [A-Za-z].");
Assert.IsTrue (rea.IsValid ("a"), "'a' does not match [A-Za-z].");
- Assert.IsTrue (rea.IsValid ("Bz"), "'Bz' does not match [A-Za-z].");
- Assert.IsTrue (rea.IsValid ("string"), "'string' does not match [A-Za-z].");
- Assert.IsFalse (rea.IsValid (String.Empty), "Empty string matches [A-Za-z].");
+ Assert.IsFalse (rea.IsValid ("Bz"), "'Bz' does not match [A-Za-z].");
+ Assert.IsFalse (rea.IsValid ("string"), "'string' does not match [A-Za-z].");
+ Assert.IsTrue (rea.IsValid (String.Empty), "Empty string matches [A-Za-z].");
Assert.IsFalse (rea.IsValid ("0123456789"), "'0123456789' matches [A-Za-z].");
Assert.IsFalse (rea.IsValid ("0123456789"), "'0123456789A' matches [A-Za-z].");
- AssertExtensions.Throws<InvalidCastException> (() => {
- rea.IsValid (123);
- }, "Casting does not fails");
- AssertExtensions.Throws<InvalidCastException> (() => {
- rea.IsValid (DateTime.Now);
- }, "Casting does not fails");
+ Assert.IsFalse (rea.IsValid (123), "Casting does not fails");
+ Assert.IsFalse (rea.IsValid (DateTime.Now), "Casting does not fails");
rea = new RegularExpressionAttributePoker ("");
- Assert.IsTrue (rea.IsValid (null), "null does not match empty pattern");
- Assert.IsTrue (rea.IsValid (String.Empty), "empty string does not match empty pattern");
- Assert.IsTrue (rea.IsValid ("string"), "'string' does not match empty pattern");
+
+ AssertExtensions.Throws<InvalidOperationException> (() => {
+ rea.IsValid (null);
+ }, "null does not match empty pattern");
+
+ AssertExtensions.Throws<InvalidOperationException> (() => {
+ rea.IsValid (String.Empty);
+ }, "empty string does not match empty pattern");
+
+ AssertExtensions.Throws<InvalidOperationException> (() => {
+ rea.IsValid ("string");
+ }, "'string' does not match empty pattern");
- AssertExtensions.Throws<ArgumentNullException> (() => {
- rea = new RegularExpressionAttributePoker (null);
- }, "Null pattern allowed");
+ rea = new RegularExpressionAttributePoker (null);
}
}
}
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/mobile_System.ComponentModel.DataAnnotations.dll.sources b/mcs/class/System.ComponentModel.DataAnnotations/mobile_System.ComponentModel.DataAnnotations.dll.sources
deleted file mode 100644
index 3de14f5e0a7..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/mobile_System.ComponentModel.DataAnnotations.dll.sources
+++ /dev/null
@@ -1 +0,0 @@
-#include net_4_5_System.ComponentModel.DataAnnotations.dll.sources
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/mobile_static_System.ComponentModel.DataAnnotations.dll.sources b/mcs/class/System.ComponentModel.DataAnnotations/mobile_static_System.ComponentModel.DataAnnotations.dll.sources
deleted file mode 100644
index 3de14f5e0a7..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/mobile_static_System.ComponentModel.DataAnnotations.dll.sources
+++ /dev/null
@@ -1 +0,0 @@
-#include net_4_5_System.ComponentModel.DataAnnotations.dll.sources
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/monodroid_System.ComponentModel.DataAnnotations.dll.sources b/mcs/class/System.ComponentModel.DataAnnotations/monodroid_System.ComponentModel.DataAnnotations.dll.sources
deleted file mode 100644
index 3de14f5e0a7..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/monodroid_System.ComponentModel.DataAnnotations.dll.sources
+++ /dev/null
@@ -1 +0,0 @@
-#include net_4_5_System.ComponentModel.DataAnnotations.dll.sources
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/monotouch_System.ComponentModel.DataAnnotations.dll.sources b/mcs/class/System.ComponentModel.DataAnnotations/monotouch_System.ComponentModel.DataAnnotations.dll.sources
deleted file mode 100644
index 3de14f5e0a7..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/monotouch_System.ComponentModel.DataAnnotations.dll.sources
+++ /dev/null
@@ -1 +0,0 @@
-#include net_4_5_System.ComponentModel.DataAnnotations.dll.sources
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/net_4_0_System.ComponentModel.DataAnnotations.dll.sources b/mcs/class/System.ComponentModel.DataAnnotations/net_4_0_System.ComponentModel.DataAnnotations.dll.sources
deleted file mode 100644
index a5a9a9d5359..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/net_4_0_System.ComponentModel.DataAnnotations.dll.sources
+++ /dev/null
@@ -1,9 +0,0 @@
-#include System.ComponentModel.DataAnnotations.dll.sources
-
-System.ComponentModel.DataAnnotations/FilterUIHintAttribute.cs
-System.ComponentModel.DataAnnotations/KeyAttribute.cs
-System.ComponentModel.DataAnnotations/TimestampAttribute.cs
-System.ComponentModel.DataAnnotations/ValidationAttributeCollectionExtensions.cs
-System.ComponentModel.DataAnnotations/ValidationContext.cs
-System.ComponentModel.DataAnnotations/ValidationResult.cs
-System.ComponentModel.DataAnnotations/Validator.cs
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/net_4_5_System.ComponentModel.DataAnnotations.dll.sources b/mcs/class/System.ComponentModel.DataAnnotations/net_4_5_System.ComponentModel.DataAnnotations.dll.sources
deleted file mode 100644
index 49e068c167e..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/net_4_5_System.ComponentModel.DataAnnotations.dll.sources
+++ /dev/null
@@ -1,17 +0,0 @@
-#include net_4_0_System.ComponentModel.DataAnnotations.dll.sources
-
-System.ComponentModel.DataAnnotations/MinLengthAttribute.cs
-System.ComponentModel.DataAnnotations/MaxLengthAttribute.cs
-System.ComponentModel.DataAnnotations/CreditCardAttribute.cs
-System.ComponentModel.DataAnnotations/EmailAddressAttribute.cs
-System.ComponentModel.DataAnnotations/PhoneAttribute.cs
-System.ComponentModel.DataAnnotations/FileExtensionsAttribute.cs
-System.ComponentModel.DataAnnotations/CompareAttribute.cs
-System.ComponentModel.DataAnnotations.Schema/ColumnAttribute.cs
-System.ComponentModel.DataAnnotations.Schema/ComplexTypeAttribute.cs
-System.ComponentModel.DataAnnotations.Schema/DatabaseGeneratedAttribute.cs
-System.ComponentModel.DataAnnotations.Schema/DatabaseGeneratedOption.cs
-System.ComponentModel.DataAnnotations.Schema/ForeignKeyAttribute.cs
-System.ComponentModel.DataAnnotations.Schema/InversePropertyAttribute.cs
-System.ComponentModel.DataAnnotations.Schema/NotMappedAttribute.cs
-System.ComponentModel.DataAnnotations.Schema/TableAttribute.cs
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/xammac_System.ComponentModel.DataAnnotations.dll.sources b/mcs/class/System.ComponentModel.DataAnnotations/xammac_System.ComponentModel.DataAnnotations.dll.sources
deleted file mode 100644
index 3de14f5e0a7..00000000000
--- a/mcs/class/System.ComponentModel.DataAnnotations/xammac_System.ComponentModel.DataAnnotations.dll.sources
+++ /dev/null
@@ -1 +0,0 @@
-#include net_4_5_System.ComponentModel.DataAnnotations.dll.sources