示例#1
0
        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);
        }
示例#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);
            }
        }
        /// <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);
        }
示例#5
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);
        }
示例#6
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 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());
        }
 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));
 }
示例#11
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));
        }