ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data Namespace / DatabaseConnectionFile Class / DatabaseConnectionFile Constructor
A valid path to a database connection file that ends with the .sde extension.
Example

In This Topic
    DatabaseConnectionFile Constructor
    In This Topic
    Initializes a new instance of the DatabaseConnectionFile class.
    Syntax
    public DatabaseConnectionFile( 
       Uri path
    )
    Public Function New( _
       ByVal path As Uri _
    )

    Parameters

    path
    A valid path to a database connection file that ends with the .sde extension.
    Exceptions
    ExceptionDescription
    path is null.
    The path in path does not end with the .sde extension.
    Example
    Opening an Enterprise Geodatabase using sde file path
    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.
            }
        });
    }
    Obtaining Definition from 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");
            }
        });
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also