/// <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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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);
        }
예제 #5
0
        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 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));
        }
        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());
        }
 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));
 }
예제 #9
0
        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));
        }