ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / LayerCreationParams Class / LayerCreationParams Constructor / LayerCreationParams Constructor(CIMDataConnection)
A ArcGIS.Core.CIM.CIMDataConnection object.
Example

In This Topic
    LayerCreationParams Constructor(CIMDataConnection)
    In This Topic
    Creates a parameter object with ArcGIS.Core.CIM.CIMDataConnection.
    Syntax
    public LayerCreationParams( 
       CIMDataConnection dataConnection
    )
    Public Function New( _
       ByVal dataConnection As CIMDataConnection _
    )

    Parameters

    dataConnection
    A ArcGIS.Core.CIM.CIMDataConnection object.
    Example
    Add a WMS service
    // Create a connection to the WMS server
    var serverConnection = new CIMInternetServerConnection { URL = "URL of the WMS service" };
    var connection = new CIMWMSServiceConnection { ServerConnection = serverConnection };
    
    // Add a new layer to the map
    var layerParams = new LayerCreationParams(connection);
    await QueuedTask.Run(() =>
    {
      var layer = LayerFactory.Instance.CreateLayer<FeatureLayer>(layerParams, MapView.Active.Map);
    });
    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);
    await QueuedTask.Run(() =>
    {
      Layer layer = LayerFactory.Instance.CreateLayer<FeatureLayer>(layerPamsDC, MapView.Active.Map);
    });
    Create a query layer
    await QueuedTask.Run(() =>
    {
      Map map = MapView.Active.Map;
      Geodatabase geodatabase = new Geodatabase(new DatabaseConnectionFile(new Uri(@"C:\Connections\mySDE.sde")));
      CIMSqlQueryDataConnection sqldc = new CIMSqlQueryDataConnection()
      {
        WorkspaceConnectionString = geodatabase.GetConnectionString(),
        GeometryType = esriGeometryType.esriGeometryPolygon,
        OIDFields = "OBJECTID",
        Srid = "102008",
        SqlQuery = "select * from MySDE.dbo.STATES",
        Dataset = "States"
      };
      var lcp = new LayerCreationParams(sqldc)
      {
        Name = "States"
      };
      FeatureLayer flyr = LayerFactory.Instance.CreateLayer<FeatureLayer>(lcp, map);
    });
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also