Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / class / System.Web.DynamicData / Test / Common / TestDataContext3.cs
1 using System;
2 using System.Collections;
3 using System.Collections.Generic;
4 using System.ComponentModel.DataAnnotations;
5 using System.Linq;
6 using System.Text;
7 using System.Web.DynamicData;
8 using System.Web.DynamicData.ModelProviders;
9 using System.Web.UI;
10 using System.Web.UI.WebControls;
11
12 using MonoTests.System.Web.DynamicData;
13 using MonoTests.ModelProviders;
14 using MonoTests.DataSource;
15
16 namespace MonoTests.Common
17 {
18         public class TestDataContext3 : ITestDataContext
19         {
20                 List<AssociatedFoo> associatedFoo;
21                 List<AssociatedBar> associatedBar;
22                 List<BazWithDataTypeAttribute> bazWithDataTypeAttribute;
23
24                 public List<AssociatedFoo> AssociatedFoo
25                 {
26                         get
27                         {
28                                 if (associatedFoo == null)
29                                         associatedFoo = new List<AssociatedFoo> ();
30
31                                 return associatedFoo;
32                         }
33                 }
34
35                 public List<AssociatedBar> AssociatedBar
36                 {
37                         get
38                         {
39                                 if (associatedBar == null)
40                                         associatedBar = new List<AssociatedBar> ();
41
42                                 return associatedBar;
43                         }
44                 }
45
46                 public List<BazWithDataTypeAttribute> BazWithDataTypeAttribute
47                 {
48                         get
49                         {
50                                 if (bazWithDataTypeAttribute == null)
51                                         bazWithDataTypeAttribute = new List<BazWithDataTypeAttribute> ();
52
53                                 return bazWithDataTypeAttribute;
54                         }
55                 }
56
57                 #region ITestDataContext Members
58                 public IList GetTableData (string tableName, DataSourceSelectArguments args, string where, ParameterCollection whereParams)
59                 {
60                         if (String.Compare (tableName, "AssociatedFooTable", StringComparison.OrdinalIgnoreCase) == 0)
61                                 return AssociatedFoo;
62
63                         if (String.Compare (tableName, "AssociatedBarTable", StringComparison.OrdinalIgnoreCase) == 0)
64                                 return AssociatedBar;
65
66                         if (String.Compare (tableName, "BazWithDataTypeAttributeTable", StringComparison.OrdinalIgnoreCase) == 0)
67                                 return BazWithDataTypeAttribute;
68
69                         return null;
70                 }
71
72                 public List<DynamicDataTable> GetTables ()
73                 {
74                         return new List<DynamicDataTable> {
75                                 new TestDataTable<AssociatedBar>(),
76                                 new TestDataTable<AssociatedFoo>(),
77                                 new TestDataTable<BazWithDataTypeAttribute> ()
78                         };
79                 }
80
81                 #endregion
82         }
83 }
84