My team is working on removing Desktop namespace references throughout our code in order to create a standalone application that doesn't rely on the Arc Pro GUI. One of the things we need to do is get data from map layers.
We can pull in the CIMMap and associated CIMFeatureLayers from a CIMLayoutDocument that describes the layout we want to render. Since we're not using the Desktop namespace, however (and since our starting point is a CIMLayoutDocument, not a Map), we can't use the FeatureLayer class's search functions.
I know Core.Data contains the Database class (along with Geodatabase and other children of Datastore). These classes seem to offer some of the functionality that we need, but we also have a home-grown class that reads through a Geodatabase given a path - either .gdb or .sde. For a layer added via a geodatabase, this makes things simple - just get the gdb path from the CIMFeatureLayer's FeatureTable's DataConnection, and use it to instantiate said home-grown class.
However, I'm wondering what to do when features from a SQL or Oracle database have been added to the map. Creating that connection in the Arc Pro Catalog automatically creates an SDE file, but when I look at the corresponding CIMFeatureLayer object in the corresponding CIMLayoutDocument, I don't see a direct reference to that .sde. Instead I see the WorkspaceConnectionString, which contains what appear to be all the necessary connection properties to instantiate a Core.Data Database object.
Let's say I just wanted to grab the .sde path associated with the enterprise database used to add that feature layer to the map....Would I need to create a Database object with the constructor that calls for a DatabaseConnectionProperties object? If so, is there a built-in way to parse the WorkspaceConnectionString into a set of DB connection properties? It seems rather roundabout, but what I would be doing is:
-parse the WorkspaceConnectionString for the Oracle / SQL (SDE) connection into its constituent properties
-create a DatabaseConnectionProperties object using those parsed properties
-Instantiate a Database object using that DatabaseConnectionProperties object
-Call GetPath() on the newly instantiated Database, which hopefully would give me some path to the .sde I need.
Is there a simpler way to do this?