1 //------------------------------------------------------------------------------
2 // <copyright file="EntityDesignerDataSourceView.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
8 //------------------------------------------------------------------------------
9 using System.Collections;
11 using System.Web.UI.Design;
13 namespace System.Web.UI.Design.WebControls
15 public class EntityDesignerDataSourceView : DesignerDataSourceView
17 private EntityDataSourceDesignerHelper _helper;
19 public EntityDesignerDataSourceView(EntityDataSourceDesigner owner)
20 : base(owner, EntityDataSourceDesignerHelper.DefaultViewName)
22 _helper = owner.Helper;
25 public override bool CanDelete
29 return CanModify && _helper.EnableDelete;
33 public override bool CanInsert
37 return CanModify && _helper.EnableInsert;
41 internal bool CanModify
45 return !String.IsNullOrEmpty(_helper.EntitySetName) &&
46 String.IsNullOrEmpty(_helper.Select) &&
47 String.IsNullOrEmpty(_helper.CommandText) &&
48 String.IsNullOrEmpty(_helper.GroupBy);
52 public override bool CanPage
56 return _helper.CanPage;
60 public override bool CanSort
64 return _helper.CanSort;
68 public override bool CanUpdate
72 return CanModify && _helper.EnableUpdate;
76 public override IDataSourceViewSchema Schema
80 DataTable schemaTable = _helper.LoadSchema();
81 if (schemaTable == null)
85 return new DataSetViewSchema(schemaTable);
89 public override IEnumerable GetDesignTimeData(int minimumRows, out bool isSampleData)
91 DataTable schemaTable = _helper.LoadSchema();
92 if (schemaTable != null)
95 return DesignTimeData.GetDesignTimeDataSource(DesignTimeData.CreateSampleDataTable(new DataView(schemaTable), true), minimumRows);
98 // Couldn't find design-time schema, use base implementation
99 return base.GetDesignTimeData(minimumRows, out isSampleData);