Implement MaxLengthAttribute
authorMarek Safar <marek.safar@gmail.com>
Thu, 19 Jul 2012 18:05:42 +0000 (19:05 +0100)
committerMarek Safar <marek.safar@gmail.com>
Thu, 19 Jul 2012 18:05:42 +0000 (19:05 +0100)
mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/MaxLengthAttribute.cs [new file with mode: 0644]
mcs/class/System.ComponentModel.DataAnnotations/net_4_5_System.ComponentModel.DataAnnotations.dll.sources

diff --git a/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/MaxLengthAttribute.cs b/mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/MaxLengthAttribute.cs
new file mode 100644 (file)
index 0000000..53e5974
--- /dev/null
@@ -0,0 +1,48 @@
+//
+// MaxLengthAttribute.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
+{
+       [AttributeUsageAttribute (AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
+       public class MaxLengthAttribute : ValidationAttribute
+       {
+               public MaxLengthAttribute ()
+               {
+               }
+               
+               public MaxLengthAttribute (int length)
+               {
+               }
+               
+               public int Length { get; private set; }
+       }
+}
+
+#endif
\ No newline at end of file
index 0b913e020bf6a11cbde4e39caf470aec96956ac0..42a430ee1c6ccd8d2326db819041e209be05afcb 100644 (file)
@@ -1,5 +1,6 @@
 #include net_4_0_System.ComponentModel.DataAnnotations.dll.sources
 
+System.ComponentModel.DataAnnotations/MaxLengthAttribute.cs
 System.ComponentModel.DataAnnotations.Schema/ColumnAttribute.cs
 System.ComponentModel.DataAnnotations.Schema/ComplexTypeAttribute.cs
 System.ComponentModel.DataAnnotations.Schema/DatabaseGeneratedAttribute.cs