registration with geodatabase

1923
1
01-21-2011 05:51 AM
LukeBadgerow
New Contributor
I'm in process of migrating the Batch Reconcile/Post utility from the developer samples from VB6 to C# and along the way I'm adding the analyze(business table) functionality.  However I'm stuck with how to verify that the feature that I'm looping over to analyze is registered with the database and available to analyze.

I had initially believed that it was because some of the tables were owned by different schemas/versions but after I ran a check for that I found that wasn't in fact the case.

any advice on this one?  I had thought to use the CLSID from an ITable/IClass but I am throwing a COMException currently because I cannot cast from an IDataset to and ITable/IClass.

the current state of my code is below.

            try
            {
                IVersionedWorkspace3 sdeVersion = (IVersionedWorkspace3)sdeWorkspace;
                sdeVersion.Compress();


                IEnumDataset datasets = sdeWorkspace.get_Datasets(esriDatasetType.esriDTAny);
                
                IDataset dataset = datasets.Next();
                while (dataset != null)
                {
                    String dsName = dataset.Name;

                    IDatasetAnalyze dbanalysis = (IDatasetAnalyze)dataset;

                    try
                    {

                        dbanalysis.Analyze((int)esriTableComponents.esriBusinessTable);

  
                    }
                    catch (Exception exception)
                    {
                        throw new Exception(String.Format("Analyze business table error: {0}", exception.Message), exception);
                    }
   
                    dataset = datasets.Next();
                }

                MessageBox.Show("compress completed successfully", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            catch
            {
                MessageBox.Show("compress failed for versioned workspace", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
0 Kudos
1 Reply
LukeBadgerow
New Contributor
as an update for anyone else.  I'm checking on registration by confirming that there is an OID field on the particular table/feature class that IDatasetEnum loops over i.e.

                    else if (dataset.Type == esriDatasetType.esriDTTable)
                    {
                        ITable table = featWork.OpenTable(dsName);
                        IFields fields = table.Fields;
                        for (int b = 0; b < fields.FieldCount; b++)
                        {
                            IField fieldName = fields.get_Field(b);
                            if (fieldName.Type == esriFieldType.esriFieldTypeOID)
                            {
                                tryAnalyze = true;
                                break;
                            }
                        }
                    }
0 Kudos