9using System.Collections;
10using System.Web.UI.Design;
11using System.ComponentModel.Design;
13using System.ComponentModel;
30 : base(owner, viewName)
45 IDataSourceViewSchema schema = this.
Schema;
46 DataTable result =
new DataTable();
49 foreach (IDataSourceFieldSchema item
in schema.GetFields())
51 result.Columns.Add(item.Name, item.DataType);
55 for (
int index = 1; index <= minimumRows; index++)
57 object[] values =
new object[result.Columns.Count];
59 foreach (DataColumn col
in result.Columns)
61 if (col.DataType.Equals(typeof(
string)))
62 values[colIndex] =
"abc";
63 else if (col.DataType.Equals(typeof(System.DateTime)))
64 values[colIndex] = System.DateTime.Today.ToShortDateString();
65 else if (col.DataType.Equals(typeof(System.DateTimeOffset)))
66 values[colIndex] = System.DateTime.Today.ToShortDateString();
67 else if (col.DataType.Equals(typeof(
bool)))
68 values[colIndex] =
false;
69 else if (col.DataType.IsPrimitive)
70 values[colIndex] = index;
71 else if (col.DataType.Equals(typeof(Guid)))
72 values[colIndex] = Guid.Empty;
73 else if (col.DataType.IsValueType)
74 values[colIndex] = Activator.CreateInstance(col.DataType);
76 values[colIndex] =
null;
79 result.LoadDataRow(values, LoadOption.OverwriteChanges);
83 return (IEnumerable)result.DefaultView;
95 public override IDataSourceViewSchema
Schema
117 private Type GetObjectType()
122 ITypeResolutionService typeService =
null;
123 typeService = (ITypeResolutionService)(_owner.Site.GetService(typeof(ITypeResolutionService)));
124 result = typeService.GetType(this._owner.DataSourceControl.
TypeName,
true,
false);
128 result = typeof(
object);
146 Type objectType = GetObjectType();
151 else if (objectType.GetMethod(
"Remove") !=
null)
175 Type objectType = GetObjectType();
200 Type objectType = GetObjectType();
string TypeName
Get or set the full type name of the business object class to be used as a data source.
bool TypeSupportsSorting
Get or set a value indicating whether the business object data source supports sorting.
bool TypeSupportsPaging
Get or set a value indicating whether the business object data source supports paging.
Implements designer support for CslaDataSource.
Object responsible for providing details about data binding to a specific CSLA .NET object.
override bool CanInsert
Get a value indicating whether data binding can directly insert an instance of the object.
CslaDesignerDataSourceView(CslaDataSourceDesigner owner, string viewName)
Creates an instance of the object.
override bool CanDelete
Get a value indicating whether data binding can directly delete the object.
override bool CanRetrieveTotalRowCount
Get a value indicating whether data binding can retrieve the total number of rows of data.
override bool CanSort
Gets a value indicating whether the data source supports sorting.
override bool CanPage
Gets a value indicating whether the data source supports paging.
override IEnumerable GetDesignTimeData(int minimumRows, out bool isSampleData)
Returns a set of sample data used to populate controls at design time.
override IDataSourceViewSchema Schema
Returns schema information corresponding to the properties of the CSLA .NET business object.
override bool CanUpdate
Get a value indicating whether data binding can directly update or edit the object.
Object providing access to schema information for a business object.
System.Web.UI.Design.IDataSourceViewSchema[] GetViews()
Returns a single element array containing the schema for the CSLA .NET business object.
Defines the methods required to participate in n-level undo within the CSLA .NET framework.