SnoBrdinRTiste

really slow retrieving list of featureclasses from sde

Discussion created by SnoBrdinRTiste on Sep 22, 2011
Latest reply on Nov 23, 2011 by SnoBrdinRTiste
my code works fine but returning a list of sde featureclasses takes quite a while
shouldn't it be quick?  my old MapObjects code to list SDE featureclasses in a listview just took less than 5 seconds...
can anyone help?  this issue is pretty annoying! :mad:

here's my code:
            ESRI.ArcGIS.Geodatabase.IEnumDataset enumDataset = workspace.get_Datasets(esriDatasetType.esriDTFeatureClass);
            enumDataset.Reset();

            lblStatus.Text = "Retrieving SDE featureclasses.  Please wait...";
            ESRI.ArcGIS.Geodatabase.IDataset dataset = enumDataset.Next();

            while (dataset != null)
            {
                //this will list the name of the featureclass in the root of the sde server
                //myFeatureclassList.Items.Add(dataset.BrowseName);
                if (dataset.BrowseName.ToString().IndexOf("Tract_" + DateTime.Now.Year.ToString()) >= 0)
                {
                    lblStatus.Text = "Adding featureclass: " + dataset.BrowseName;

                    //have to use a delegate or in this case INVOKE to prevent the cross-thread error
                    this.Invoke((Action)(() => myFeatureclassList.Items.Add(dataset.BrowseName))); 
                }
                dataset = enumDataset.Next();
            }

            lblStatus.Text = "Sorting contents...please wait...";
            this.Invoke((Action)(() => list_featureclass.Sorted = true));

Outcomes