How can I get the database for a layer based on the CIMFeatureDatasetDataConnection (GetDataConnection)?

08-16-2015 10:11 AM
New Contributor III

Hi there,

I was wondering if it's possible to get the actual geodatabase through the BasicFeatureLayer.GetDataConnection() method, which (can) return a CIMFeatureDatasetDataConnection.

I found, that when working with a filegdb, I can get the path for the fgdb. The path I can use in return to create a new Geodatabase object. If I try to do the same with an enterprise gdb, I can retrieve only the connection string. Even though I can use the connection string to create a new ConnectionProperies object, the object can not be used to open a Geodatabase. If I try this, I can some type of time-out.

I'm now wondering, if there's an easier way to get the underlying Geodatabase object for a feature layer.

thanks in advance,


Tags (1)
0 Kudos
2 Replies
Esri Regular Contributor

Like so:

//assume that the first layer of the map is a FeatureLayer

            var featLayer = MapView.Active.Map.GetLayersAsFlattenedList()[0] as FeatureLayer;

            await QueuedTask.Run(() =>


                var fc = ((FeatureLayer)featLayer).GetFeatureClass();

                var gdb = fc.GetDatastore() as Geodatabase;

                //Do something with the gdb


0 Kudos
New Contributor III

Hi Charles,

thanks for the info. This was exactly what I was looking for.

Cheers, Chris

0 Kudos