Select to view content in your preferred language

GetDefinitions takes forever to list feature classes in geodatabase

184
1
07-22-2024 08:30 AM
AndyFoy
New Contributor

I'm trying to list a subset of feature classes in a SQL Server database. So I'm executing geodatabase.GetDefinitions<FeatureClassDefinition>() and then filtering the resulting IReadOnlyList based on a wildcard match.

Most SQL tables and views are fine when executing geodatabase.GetDefinitions<FeatureClassDefinition>(), but the problem is that it is handing whenever it encounters any complex SQL views. I can see this using the Diagnostic Window when it displays, e.g.

function="Geodatabase.Table.OpenDataset" code="BeginOpenDataset"

but then never reaches an equivalent "EndOpenDataset".

My code is:

            await QueuedTask.Run(() =>
            {
                try
                {
                    // Try and get all of the feature class definitions.
                    IReadOnlyList<FeatureClassDefinition> fcDefinitions = _geodatabase.GetDefinitions<FeatureClassDefinition>();
                    foreach (var definition in fcDefinitions)
                    {
                        // Get the name of the feature class and add it to the list.
                        _tableNames.Add(definition.GetName());
                    }
                }
                catch (Exception)
                {
                    // GetDefinitions throws an exception.
                    throw;
                }
            });

I'm only trying to list all of the feature classes so that I can filter them to a subset that the user can then choose from and run a query on. How can I resolve this so that it doesn't hang?

0 Kudos
1 Reply
Aashis
by Esri Contributor
Esri Contributor

@AndyFoy What does your complex SQL view look like? Could you please give us some details so we can reproduce the issue in-house and fix it?

0 Kudos