ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMStandardDataConnection Class
Members Example

In This Topic
    CIMStandardDataConnection Class
    In This Topic
    Represents a standard data connection, the most common data connection type.
    Object Model
    CIMStandardDataConnection ClassCIMStandardDataConnection ClassCIMStandardDataConnection Class
    Syntax
    Example
    Add a WFS Service
    {
        CIMStandardDataConnection cIMStandardDataConnection = new CIMStandardDataConnection()
        {
            WorkspaceConnectionString = @"SWAPXY=TRUE;SWAPXYFILTER=FALSE;URL=http://sampleserver6.arcgisonline.com/arcgis/services/SampleWorldCities/MapServer/WFSServer;VERSION=2.0.0",
            WorkspaceFactory = WorkspaceFactory.WFS,
            Dataset = "Continent",
            DatasetType = esriDatasetType.esriDTFeatureClass
        };
    
        // Add a new layer to the map
        var layerPamsDC = new LayerCreationParams(cIMStandardDataConnection);
        //Note: Needs QueuedTask to run
        Layer layerCreated = LayerFactory.Instance.CreateLayer<FeatureLayer>(layerPamsDC, MapView.Active.Map);
    }
    Reset the URL of a feature service layer
    {
        CIMStandardDataConnection dataConnection = featureLayer.GetDataConnection() as CIMStandardDataConnection;
        dataConnection.WorkspaceConnectionString = @"DATABASE=C:\Data\USNationalParks\USNationalParks.gdb";
        //Note: needs to be called on the MCT
        featureLayer.SetDataConnection(dataConnection);
    }
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.CIM.CIMObject
          ArcGIS.Core.CIM.CIMDataConnection
             ArcGIS.Core.CIM.CIMStandardDataConnection

    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also