DynamicDataContainerColumnProvider.cs 1001 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.DynamicData;
  6. using System.Web.DynamicData.ModelProviders;
  7. using MonoTests.DataSource;
  8. namespace MonoTests.ModelProviders
  9. {
  10. public class DynamicDataContainerColumnProvider : ColumnProvider
  11. {
  12. DynamicDataColumn column;
  13. public DynamicDataContainerColumnProvider (DynamicDataContainerTableProvider owner, DynamicDataColumn column)
  14. : base (owner)
  15. {
  16. if (column == null)
  17. throw new ArgumentNullException ("column");
  18. this.column = column;
  19. Type columnType = column.DataType;
  20. if (columnType == null)
  21. throw new InvalidOperationException ("column.DataType must not be null for column '" + column.Name + "'");
  22. Name = column.Name;
  23. ColumnType = columnType;
  24. Nullable = columnType.IsGenericType && typeof (Nullable<>).IsAssignableFrom (columnType.GetGenericTypeDefinition ());
  25. IsPrimaryKey = column.PrimaryKey;
  26. IsForeignKeyComponent = column.ForeignKey;
  27. }
  28. }
  29. }