public IReadOnlyList<T> GetDefinitions<T>() where T: Definition
Public Function GetDefinitions(Of T As Definition)() As IReadOnlyList(Of T)
Type Parameters
- T
- The type of dataset definition.
public IReadOnlyList<T> GetDefinitions<T>() where T: Definition
Public Function GetDefinitions(Of T As Definition)() As IReadOnlyList(Of T)
Exception | Description |
---|---|
System.InvalidOperationException | No valid geodatabase has been opened prior to calling this operation or the DatasetType type is not supported. |
ArcGIS.Core.Data.Exceptions.GeodatabaseException | A geodatabase-related exception has occurred. |
public async Task ObtainingDefinitionsFromGeodatabase() { await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { using (Geodatabase geodatabase = new Geodatabase(new DatabaseConnectionFile(new Uri("path\\to\\sde\\file\\sdefile.sde")))) { IReadOnlyList<FeatureClassDefinition> enterpriseDefinitions = geodatabase.GetDefinitions<FeatureClassDefinition>(); IEnumerable<Definition> featureClassesHavingGlobalID = enterpriseDefinitions.Where(definition => definition.HasGlobalID()); IReadOnlyList<FeatureDatasetDefinition> featureDatasetDefinitions = geodatabase.GetDefinitions<FeatureDatasetDefinition>(); bool electionRelatedFeatureDatasets = featureDatasetDefinitions.Any(definition => definition.GetName().Contains("Election")); IReadOnlyList<AttributedRelationshipClassDefinition> attributedRelationshipClassDefinitions = geodatabase.GetDefinitions<AttributedRelationshipClassDefinition>(); IReadOnlyList<RelationshipClassDefinition> relationshipClassDefinitions = geodatabase.GetDefinitions<RelationshipClassDefinition>(); } }); }
public async Task GetFeatureClassesInRelationshipClassAsync() { await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { using (Geodatabase geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(@"C:\Data\LocalGovernment.gdb")))) { IReadOnlyList<RelationshipClassDefinition> relationshipClassDefinitions = geodatabase.GetDefinitions<RelationshipClassDefinition>(); foreach (RelationshipClassDefinition relationshipClassDefinition in relationshipClassDefinitions) { IReadOnlyList<Definition> definitions = geodatabase.GetRelatedDefinitions(relationshipClassDefinition, DefinitionRelationshipType.DatasetsRelatedThrough); foreach (Definition definition in definitions) { System.Diagnostics.Debug.WriteLine($"Feature class in the RelationshipClass is:{definition.GetName()}"); } } } }); }
Target Platforms: Windows 11, Windows 10