You've already forked linux-packaging-mono
Imported Upstream version 4.0.0~alpha1
Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
@ -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";
|
||||
}
|
||||
}
|
@ -9,21 +9,8 @@ LIB_MCS_FLAGS = \
|
||||
/r:System.Data.dll \
|
||||
/r:System.Xml.dll \
|
||||
|
||||
|
||||
ifeq (2.0, $(FRAMEWORK_VERSION))
|
||||
# This is a .NET 3.5 only assembly, but built during the 2.0 build
|
||||
LIB_MCS_FLAGS += -d:NET_3_5
|
||||
endif
|
||||
|
||||
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
|
||||
|
||||
# This is a .NET 3.5+ assembly
|
||||
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5 monotouch monodroid xammac mobile mobile_static, $(PROFILE))
|
||||
ifndef VALID_PROFILE
|
||||
LIBRARY_NAME = dummy-System.ComponentModel.DataAnnotations.dll
|
||||
NO_INSTALL = yes
|
||||
NO_SIGN_ASSEMBLY = yes
|
||||
NO_TEST = yes
|
||||
endif
|
||||
RESOURCE_STRINGS = ../../../external/referencesource/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations.txt
|
||||
|
||||
include ../../build/library.make
|
||||
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
||||
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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.
|
@ -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
|
@ -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
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user