2009-07-11 Michael Barker <mike@middlesoft.co.uk>
[mono.git] / mcs / class / System.Web.DynamicData / Test / Common / FooWithMetadataType.cs
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.ComponentModel.DataAnnotations;
5 using System.Linq;
6 using System.Text;
7
8 namespace MonoTests.Common
9 {
10         [MetadataType (typeof (FooMetaDataType))]
11         class FooWithMetadataType
12         {
13                 [DefaultValue ("Value")]
14                 [Description ("Description")]
15                 public string Column1 { get; set; }
16                 public string Column2 { get; set; }
17
18                 [DisplayName ("Column three")]
19                 public string Column3 { get; set; }
20                 public string Column4 { get; set; }
21
22                 [Required]
23                 public bool Column5 { get; set; }
24
25                 // This will cause the column to be treated the way nullable database
26                 // columns are - that is, its associated MetaColumn.IsRequired will
27                 // return false (this is thanks to our test DynamicDataContainerColumnProvider
28                 public bool? Column6 { get; set; }
29                 public string Column7 { get; set; }
30         }
31
32         [DisplayColumn ("Column2")]
33         class FooMetaDataType
34         {
35                 [DisplayFormat (
36                         ApplyFormatInEditMode = true, 
37                         ConvertEmptyStringToNull=true,
38                         DataFormatString="Item: {0}"
39                 )]
40                 public string Column1;
41
42                 [DefaultValue ("Value")]
43                 [DataType (DataType.Time)]
44                 public string Column2;
45
46                 [DefaultValue (123)]
47                 [DataType (DataType.Currency)]
48                 [Description ("Description")]
49                 public int Column3;
50
51                 [DisplayName ("Column four")]
52                 public string Column4 { get; set; }
53
54                 [Required]
55                 public string Column7;
56         }
57 }