TestDataContext3.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. using MonoTests.System.Web.DynamicData;
  12. using MonoTests.ModelProviders;
  13. using MonoTests.DataSource;
  14. namespace MonoTests.Common
  15. {
  16. public class TestDataContext3 : ITestDataContext
  17. {
  18. List<AssociatedFoo> associatedFoo;
  19. List<AssociatedBar> associatedBar;
  20. List<BazWithDataTypeAttribute> bazWithDataTypeAttribute;
  21. public List<AssociatedFoo> AssociatedFoo
  22. {
  23. get
  24. {
  25. if (associatedFoo == null)
  26. associatedFoo = new List<AssociatedFoo> ();
  27. return associatedFoo;
  28. }
  29. }
  30. public List<AssociatedBar> AssociatedBar
  31. {
  32. get
  33. {
  34. if (associatedBar == null)
  35. associatedBar = new List<AssociatedBar> ();
  36. return associatedBar;
  37. }
  38. }
  39. public List<BazWithDataTypeAttribute> BazWithDataTypeAttribute
  40. {
  41. get
  42. {
  43. if (bazWithDataTypeAttribute == null)
  44. bazWithDataTypeAttribute = new List<BazWithDataTypeAttribute> ();
  45. return bazWithDataTypeAttribute;
  46. }
  47. }
  48. #region ITestDataContext Members
  49. public IList GetTableData (string tableName, DataSourceSelectArguments args, string where, ParameterCollection whereParams)
  50. {
  51. if (String.Compare (tableName, "AssociatedFooTable", StringComparison.OrdinalIgnoreCase) == 0)
  52. return AssociatedFoo;
  53. if (String.Compare (tableName, "AssociatedBarTable", StringComparison.OrdinalIgnoreCase) == 0)
  54. return AssociatedBar;
  55. if (String.Compare (tableName, "BazWithDataTypeAttributeTable", StringComparison.OrdinalIgnoreCase) == 0)
  56. return BazWithDataTypeAttribute;
  57. return null;
  58. }
  59. public List<DynamicDataTable> GetTables ()
  60. {
  61. return new List<DynamicDataTable> {
  62. new TestDataTable<AssociatedBar>(),
  63. new TestDataTable<AssociatedFoo>(),
  64. new TestDataTable<BazWithDataTypeAttribute> ()
  65. };
  66. }
  67. #endregion
  68. }
  69. }