/// <include file='doc\BaseDataListDesigner.uex' path='docs/doc[@for="BaseDataListDesigner.GetDesignTimeDataSource1"]/*' /> /// <devdoc> /// <para> /// Gets sample data matching the schema of the selected data source. /// </para> /// </devdoc> protected IEnumerable GetDesignTimeDataSource(IEnumerable selectedDataSource, int minimumRows, out bool dummyDataSource) { DataTable dataTable = designTimeDataTable; dummyDataSource = false; // use the datatable corresponding to the selected datasource if possible if (dataTable == null) { if (selectedDataSource != null) { designTimeDataTable = DesignTimeData.CreateSampleDataTable(selectedDataSource); dataTable = designTimeDataTable; } if (dataTable == null) { // fallback on a dummy datasource if we can't create a sample datatable if (dummyDataTable == null) { dummyDataTable = DesignTimeData.CreateDummyDataTable(); } dataTable = dummyDataTable; dummyDataSource = true; } } IEnumerable liveDataSource = DesignTimeData.GetDesignTimeDataSource(dataTable, minimumRows); return(liveDataSource); }
public override IEnumerable GetDesignTimeData(int minimumRows, out bool isSampleData) { isSampleData = false; if (this.SelectedColumns != null) { DataTable table = new DataTable(); foreach (string columnName in this.SelectedColumns) { esColumnMetadata col = this.esColumnCollection.FindByPropertyName(columnName); if (!col.IsConcurrency) { DataColumn dc = table.Columns.Add(col.PropertyName, col.Type); if (col.IsInPrimaryKey) { dc.Unique = true; } } } if (table != null) { isSampleData = true; return(DesignTimeData.GetDesignTimeDataSource(DesignTimeData.CreateSampleDataTable(new DataView(table), true), minimumRows)); } return(base.GetDesignTimeData(minimumRows, out isSampleData)); } else { return(null); } }
private IEnumerable GetDesignTimeDataSource(int minimumRows) { IEnumerable selectedDataSource = ((IDataSourceProvider)this).GetResolvedSelectedDataSource(); DataTable dtTable = new DataTable(); if (dtTable == null) { if (selectedDataSource != null) { dtTable = DesignTimeData.CreateSampleDataTable(selectedDataSource); } if (dtTable == null) { if (dummyTable == null) { dummyTable = DesignTimeData.CreateDummyDataTable(); } dtTable = dummyTable; } } IEnumerable realDataSource = DesignTimeData.GetDesignTimeDataSource(dtTable, minimumRows); return(realDataSource); }
private IEnumerable GetDesignTimeDataSource(int minimumRows) { IEnumerable selectedDataSource = ((IDataSourceProvider)this).GetResolvedSelectedDataSource(); DataTable dataTable = _designTimeDataTable; // Use the data table corresponding to the selected data source if possible. if (dataTable == null) { if (selectedDataSource != null) { _designTimeDataTable = DesignTimeData.CreateSampleDataTable(selectedDataSource); dataTable = _designTimeDataTable; } if (dataTable == null) { // Fall back on a dummy data source if we can't create a sample data table. if (_dummyDataTable == null) { _dummyDataTable = DesignTimeData.CreateDummyDataTable(); } dataTable = _dummyDataTable; } } IEnumerable liveDataSource = DesignTimeData.GetDesignTimeDataSource(dataTable, minimumRows); return(liveDataSource); }
public override IEnumerable GetDesignTimeData(int minimumRows, out bool isSampleData) { string siteMapProvider = null; string startingNodeUrl = null; SiteMapNodeCollection nodes = null; siteMapProvider = this._siteMapDataSource.SiteMapProvider; startingNodeUrl = this._siteMapDataSource.StartingNodeUrl; this._siteMapDataSource.Provider = this._owner.DesignTimeSiteMapProvider; try { this._siteMapDataSource.StartingNodeUrl = null; nodes = ((SiteMapDataSourceView)((IDataSource)this._siteMapDataSource).GetView(base.Name)).Select(DataSourceSelectArguments.Empty) as SiteMapNodeCollection; isSampleData = false; } finally { this._siteMapDataSource.StartingNodeUrl = startingNodeUrl; this._siteMapDataSource.SiteMapProvider = siteMapProvider; } if ((nodes != null) && (nodes.Count == 0)) { isSampleData = true; return(DesignTimeData.GetDesignTimeDataSource(DesignTimeData.CreateDummyDataBoundDataTable(), minimumRows)); } return(nodes); }
public override IEnumerable GetDesignTimeData(int minimumRows, out bool isSampleData) { DataTable table = this._owner.LoadSchema(); if (table != null) { isSampleData = true; return(DesignTimeData.GetDesignTimeDataSource(DesignTimeData.CreateSampleDataTable(new DataView(table), true), minimumRows)); } return(base.GetDesignTimeData(minimumRows, out isSampleData)); }
public IEnumerable GetResolvedSelectedDataSource() { IEnumerable enumerable = null; DataBinding binding = base.DataBindings["DataSource"]; if (binding != null) { enumerable = DesignTimeData.GetSelectedDataSource(base.Component, binding.Expression, this.DataMember); } return(enumerable); }
/// <summary> /// Used by the DataMemberConverter to resolve the DataSource which it can then use /// to populate a drop down box containing a list of available tables. /// </summary> /// <returns>The object that is our DataSource</returns> object IDataSourceProvider.GetSelectedDataSource() { DataBinding binding; binding = this.DataBindings["DataSource"]; if (binding != null) { return(DesignTimeData.GetSelectedDataSource(this.Component, binding.Expression)); } return(null); }
/// <summary> /// Used by the DataFieldConverter to resolve the DataSource and DataMember combination /// so that it can populate a dropdown with a list of available fields. /// </summary> IEnumerable IDataSourceProvider.GetResolvedSelectedDataSource() { DataBinding binding; binding = this.DataBindings["DataSource"]; if (binding != null) { return(DesignTimeData.GetSelectedDataSource(this.Component, binding.Expression, this.DataMember)); } return(null); }
public object GetSelectedDataSource() { object selectedDataSource = null; DataBinding binding = base.DataBindings["DataSource"]; if (binding != null) { selectedDataSource = DesignTimeData.GetSelectedDataSource(base.Component, binding.Expression); } return(selectedDataSource); }
object IDataSourceProvider.GetSelectedDataSource() { object selectedDataSource = null; DataBinding binding = base.DataBindings["DataSource"]; if (binding != null) { selectedDataSource = DesignTimeData.GetSelectedDataSource((DataBoundControl)base.Component, binding.Expression); } return(selectedDataSource); }
IEnumerable IDataSourceProvider.GetResolvedSelectedDataSource() { IEnumerable enumerable = null; DataBinding binding = base.DataBindings["DataSource"]; if (binding != null) { enumerable = DesignTimeData.GetSelectedDataSource((DataBoundControl)base.Component, binding.Expression, this.DataMember); } return(enumerable); }
public IEnumerable GetResolvedSelectedDataSource() { IEnumerable selectedDataSource = null; DataBinding binding = DataBindings[_dataSourcePropertyName]; if (binding != null) { selectedDataSource = DesignTimeData.GetSelectedDataSource(_objectList, binding.Expression, DataMember); } return(selectedDataSource); }
public override IEnumerable GetDesignTimeData(int minimumRows, out bool isSampleData) { DataTable schemaTable = _helper.LoadSchema(); if (schemaTable != null) { isSampleData = true; return(DesignTimeData.GetDesignTimeDataSource(DesignTimeData.CreateSampleDataTable(new DataView(schemaTable), true), minimumRows)); } // Couldn't find design-time schema, use base implementation return(base.GetDesignTimeData(minimumRows, out isSampleData)); }
/// <summary> /// <para> /// Gets the selected data source component from the component's container. /// </para> /// </summary> /// <returns> /// <para> /// An IEnumerable with the /// selected data source, or <see langword='null'/> if a data source is not found, or if a data /// source with the same name does not exist. /// </para> /// </returns> /// <seealso cref='System.Web.UI.Design.IDataSourceProvider'/> public Object GetSelectedDataSource() { Object selectedDataSource = null; DataBinding binding = DataBindings[_dataSourcePropertyName]; if (binding != null) { selectedDataSource = DesignTimeData.GetSelectedDataSource(_objectList, binding.Expression); } return(selectedDataSource); }
/// <include file='doc\RepeaterDesigner.uex' path='docs/doc[@for="RepeaterDesigner.GetSelectedDataSource"]/*' /> /// <devdoc> /// Retrieves the selected datasource component from the component's container. /// </devdoc> public object GetSelectedDataSource() { object selectedDataSource = null; DataBinding binding = DataBindings["DataSource"]; if (binding != null) { selectedDataSource = DesignTimeData.GetSelectedDataSource(repeater, binding.Expression); } return(selectedDataSource); }
/// <include file='doc\BaseDataListDesigner.uex' path='docs/doc[@for="BaseDataListDesigner.GetResolvedSelectedDataSource"]/*' /> /// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public IEnumerable GetResolvedSelectedDataSource() { IEnumerable selectedDataSource = null; DataBinding binding = DataBindings["DataSource"]; if (binding != null) { selectedDataSource = DesignTimeData.GetSelectedDataSource(bdl, binding.Expression, DataMember); } return(selectedDataSource); }
IEnumerable IDataSourceProvider.GetResolvedSelectedDataSource() { IEnumerable selectedDataSource = null; DataBinding binding = DataBindings["DataSource"]; if (binding != null) { selectedDataSource = DesignTimeData.GetSelectedDataSource(Component, binding.Expression, DataMember); } return(selectedDataSource); }
protected virtual IEnumerable GetSampleDataSource() { DataTable dataTable = null; if (((DataBoundControl)base.Component).DataSourceID.Length > 0) { dataTable = DesignTimeData.CreateDummyDataBoundDataTable(); } else { dataTable = DesignTimeData.CreateDummyDataTable(); } return(DesignTimeData.GetDesignTimeDataSource(dataTable, this.SampleRowCount)); }
protected virtual IEnumerable GetDesignTimeDataSource() { bool flag; IEnumerable designTimeData = null; DesignerDataSourceView designerView = this.DesignerView; if (designerView != null) { try { designTimeData = designerView.GetDesignTimeData(this.SampleRowCount, out flag); } catch (Exception exception) { if (base.Component.Site != null) { IComponentDesignerDebugService service = (IComponentDesignerDebugService)base.Component.Site.GetService(typeof(IComponentDesignerDebugService)); if (service != null) { service.Fail(System.Design.SR.GetString("DataSource_DebugService_FailedCall", new object[] { "DesignerDataSourceView.GetDesignTimeData", exception.Message })); } } } } else { IEnumerable resolvedSelectedDataSource = ((IDataSourceProvider)this).GetResolvedSelectedDataSource(); if (resolvedSelectedDataSource != null) { designTimeData = DesignTimeData.GetDesignTimeDataSource(DesignTimeData.CreateSampleDataTable(resolvedSelectedDataSource), this.SampleRowCount); flag = true; } } if (designTimeData != null) { ICollection is2 = designTimeData as ICollection; if ((is2 == null) || (is2.Count > 0)) { return(designTimeData); } } flag = true; return(this.GetSampleDataSource()); }
protected virtual IHierarchicalEnumerable GetDesignTimeDataSource() { bool flag; IHierarchicalEnumerable designTimeData = null; DesignerHierarchicalDataSourceView designerView = this.DesignerView; if (designerView != null) { try { designTimeData = designerView.GetDesignTimeData(out flag); } catch (Exception exception) { if (base.Component.Site != null) { IComponentDesignerDebugService service = (IComponentDesignerDebugService)base.Component.Site.GetService(typeof(IComponentDesignerDebugService)); if (service != null) { service.Fail(System.Design.SR.GetString("DataSource_DebugService_FailedCall", new object[] { "DesignerHierarchicalDataSourceView.GetDesignTimeData", exception.Message })); } } } } else { DataBinding binding = base.DataBindings["DataSource"]; if (binding != null) { designTimeData = DesignTimeData.GetSelectedDataSource(base.Component, binding.Expression, null) as IHierarchicalEnumerable; } } if (designTimeData != null) { ICollection is2 = designTimeData as ICollection; if ((is2 == null) || (is2.Count > 0)) { return(designTimeData); } } flag = true; return(this.GetSampleDataSource()); }
/// <include file='doc\DataMemberConverter.uex' path='docs/doc[@for="DataMemberConverter.GetStandardValues"]/*' /> /// <devdoc> /// <para> /// Gets the fields present within the selected data source if information about them is available. /// </para> /// </devdoc> public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { string[] names = null; if (context != null) { IComponent component = context.Instance as IComponent; if (component is IDeviceSpecificChoiceDesigner) { component = ((IDeviceSpecificChoiceDesigner)component).UnderlyingControl; } if (component != null) { ISite componentSite = component.Site; if (componentSite != null) { IDesignerHost designerHost = (IDesignerHost)componentSite.GetService(typeof(IDesignerHost)); if (designerHost != null) { IDesigner designer = designerHost.GetDesigner(component); if (designer is IDataSourceProvider) { object dataSource = ((IDataSourceProvider)designer).GetSelectedDataSource(); if (dataSource != null) { names = DesignTimeData.GetDataMembers(dataSource); } } } } } if (names == null) { names = new string[0]; } Array.Sort(names); } return(new StandardValuesCollection(names)); }
public override IEnumerable GetDesignTimeData(int minimumRows, out bool isSampleData) { isSampleData = true; DataTable[] tableArray = this._owner.LoadSchema(); if ((tableArray != null) && (tableArray.Length > 0)) { if (base.Name.Length == 0) { return(DesignTimeData.GetDesignTimeDataSource(DesignTimeData.CreateSampleDataTable(new DataView(tableArray[0]), true), minimumRows)); } foreach (DataTable table in tableArray) { if (string.Equals(table.TableName, base.Name, StringComparison.OrdinalIgnoreCase)) { return(DesignTimeData.GetDesignTimeDataSource(DesignTimeData.CreateSampleDataTable(new DataView(table), true), minimumRows)); } } } return(base.GetDesignTimeData(minimumRows, out isSampleData)); }
protected IEnumerable GetDesignTimeDataSource(IEnumerable selectedDataSource, int minimumRows) { DataTable designTimeDataTable = this.designTimeDataTable; if (designTimeDataTable == null) { if (selectedDataSource != null) { this.designTimeDataTable = DesignTimeData.CreateSampleDataTable(selectedDataSource); designTimeDataTable = this.designTimeDataTable; } if (designTimeDataTable == null) { if (this.dummyDataTable == null) { this.dummyDataTable = DesignTimeData.CreateDummyDataTable(); } designTimeDataTable = this.dummyDataTable; } } return(DesignTimeData.GetDesignTimeDataSource(designTimeDataTable, minimumRows)); }
public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { object[] objArray1 = null; if (context != null) { IComponent component1 = context.Instance as IComponent; if (component1 != null) { ISite site1 = component1.Site; if (site1 != null) { IDesignerHost host1 = (IDesignerHost)site1.GetService(typeof(IDesignerHost)); if (host1 != null) { IDesigner designer1 = host1.GetDesigner(component1); DesignerDataSourceView view1 = this.GetView(designer1); if (view1 != null) { IDataSourceViewSchema schema1 = null; try { schema1 = view1.Schema; } catch (Exception exception1) { IComponentDesignerDebugService service1 = (IComponentDesignerDebugService)site1.GetService(typeof(IComponentDesignerDebugService)); if (service1 != null) { service1.Fail("DataSource DebugService FailedCall\r\n" + exception1.ToString()); } } if (schema1 != null) { IDataSourceFieldSchema[] schemaArray1 = schema1.GetFields(); if (schemaArray1 != null) { objArray1 = new object[schemaArray1.Length]; for (int num1 = 0; num1 < schemaArray1.Length; num1++) { objArray1[num1] = schemaArray1[num1].Name; } } } } if (((objArray1 == null) && (designer1 != null)) && (designer1 is IDataSourceProvider)) { IDataSourceProvider provider1 = designer1 as IDataSourceProvider; IEnumerable enumerable1 = null; if (provider1 != null) { enumerable1 = provider1.GetResolvedSelectedDataSource(); } if (enumerable1 != null) { PropertyDescriptorCollection collection1 = DesignTimeData.GetDataFields(enumerable1); if (collection1 != null) { ArrayList list1 = new ArrayList(); foreach (PropertyDescriptor descriptor1 in collection1) { list1.Add(descriptor1.Name); } objArray1 = list1.ToArray(); } } } } } } } return(new TypeConverter.StandardValuesCollection(objArray1)); }
/// <include file='doc\DataFieldConverter.uex' path='docs/doc[@for="DataFieldConverter.GetStandardValues"]/*' /> /// <devdoc> /// <para> /// Gets the fields present within the selected data source if information about them is available. /// </para> /// </devdoc> public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { object[] names = null; String dataMember = null; bool autoGenerateFields = false; bool autoGenerateFieldsSet = false; ObjectList objectList = null; if (context != null) { ArrayList list = new ArrayList(); PropertyDescriptorCollection props = null; IComponent component = context.Instance as IComponent; if (component is IDeviceSpecificChoiceDesigner) { Object owner = ((ChoicePropertyFilter)component).Owner; PropertyDescriptor pd = ((ICustomTypeDescriptor)component).GetProperties()[_dataMemberPropertyName]; Debug.Assert(pd != null, "Cannot get DataMember"); if (owner is ObjectList) { autoGenerateFields = ((ObjectList)owner).AutoGenerateFields; autoGenerateFieldsSet = true; } component = ((IDeviceSpecificChoiceDesigner)component).UnderlyingControl; // See if owner already has a DataMember dataMember = (String)pd.GetValue(owner); Debug.Assert(dataMember != null); if (dataMember == String.Empty) { // Get it from underlying object. dataMember = (String)pd.GetValue(component); Debug.Assert(dataMember != null); } } if (component != null) { objectList = component as ObjectList; if (objectList != null) { foreach (ObjectListField field in objectList.Fields) { list.Add(field.Name); } if (!autoGenerateFieldsSet) { autoGenerateFields = objectList.AutoGenerateFields; } } if (objectList == null || autoGenerateFields) { ISite componentSite = component.Site; if (componentSite != null) { IDesignerHost designerHost = (IDesignerHost)componentSite.GetService(typeof(IDesignerHost)); if (designerHost != null) { IDesigner designer = designerHost.GetDesigner(component); if (designer is IDataSourceProvider) { IEnumerable dataSource = null; if (dataMember != null && dataMember != String.Empty) { DataBindingCollection dataBindings = ((HtmlControlDesigner)designer).DataBindings; DataBinding binding = dataBindings[_dataSourcePropertyName]; if (binding != null) { dataSource = DesignTimeData.GetSelectedDataSource( component, binding.Expression, dataMember); } } else { dataSource = ((IDataSourceProvider)designer).GetResolvedSelectedDataSource(); } if (dataSource != null) { props = DesignTimeData.GetDataFields(dataSource); } } } } } } if (props != null) { foreach (PropertyDescriptor propDesc in props) { list.Add(propDesc.Name); } } names = list.ToArray(); Array.Sort(names); } return(new StandardValuesCollection(names)); }
public StringCollection GetStandardValues(Component component) { StringCollection fields = new StringCollection(); if (component != null) { ISite site1 = component.Site; if (site1 != null) { IDesignerHost host1 = (IDesignerHost)site1.GetService(typeof(IDesignerHost)); if (host1 != null) { IDesigner designer1 = host1.GetDesigner(component); DesignerDataSourceView view1 = ((DataBoundControlDesigner)designer1).DesignerView; if (view1 != null) { IDataSourceViewSchema schema1 = null; try { schema1 = view1.Schema; } catch (Exception exception1) { IComponentDesignerDebugService service1 = (IComponentDesignerDebugService)site1.GetService(typeof(IComponentDesignerDebugService)); if (service1 != null) { service1.Fail("DataSource DebugService FailedCall\r\n" + exception1.ToString()); } } if (schema1 != null) { IDataSourceFieldSchema[] schemaArray1 = schema1.GetFields(); if (schemaArray1 != null) { for (int num1 = 0; num1 < schemaArray1.Length; num1++) { fields.Add(schemaArray1[num1].Name); } } } } if (((fields.Count == 0) && (designer1 != null)) && (designer1 is IDataSourceProvider)) { IDataSourceProvider provider1 = designer1 as IDataSourceProvider; IEnumerable enumerable1 = null; if (provider1 != null) { enumerable1 = provider1.GetResolvedSelectedDataSource(); } if (enumerable1 != null) { PropertyDescriptorCollection collection1 = DesignTimeData.GetDataFields(enumerable1); if (collection1 != null) { foreach (PropertyDescriptor descriptor1 in collection1) { fields.Add(descriptor1.Name); } } } } } } } return(fields); }