Parameters
- path
- A valid path to a database connection file that ends with the .sde extension.
DatabaseConnectionFile
class.Exception | Description |
---|---|
System.ArgumentNullException | path is null. |
System.ArgumentException | The path in path does not end with the .sde extension. |
public async Task OpenEnterpriseGeodatabaseUsingSDEFilePath() { await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { using (Geodatabase geodatabase = new Geodatabase(new DatabaseConnectionFile(new Uri("path\\to\\sde\\file\\sdefile.sde")))) { // Use the geodatabase. } }); }
public async Task ObtainingDefinitionFromGeodatabase() { await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => { using (Geodatabase geodatabase = new Geodatabase(new DatabaseConnectionFile(new Uri("path\\to\\sde\\file\\sdefile.sde")))) { // Remember that for Enterprise databases you have to qualify your dataset names with the DatabaseName and UserName. TableDefinition enterpriseTableDefinition = geodatabase.GetDefinition<TableDefinition>("LocalGovernment.GDB.CitizenContactInfo"); // It does not matter if the dataset is within a FeatureDataset or not. FeatureClassDefinition featureClassDefinition = geodatabase.GetDefinition<FeatureClassDefinition>("LocalGovernment.GDB.FireStation"); // GetDefinition For a RelationshipClass. RelationshipClassDefinition relationshipClassDefinition = geodatabase.GetDefinition<RelationshipClassDefinition>("LocalGovernment.GDB.AddressPointHasSiteAddresses"); // GetDefinition For a FeatureDataset. FeatureDatasetDefinition featureDatasetDefinition = geodatabase.GetDefinition<FeatureDatasetDefinition>("LocalGovernment.GDB.Address"); } }); }
Target Platforms: Windows 11, Windows 10