ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data.UtilityNetwork Namespace / Association Class / Association Constructor / Association Constructor(AssociationType,Element,Element)
The type of association between fromElement and toElement.
Example

In This Topic
    Association Constructor(AssociationType,Element,Element)
    In This Topic
    Initializes a new instance of the Association class.
    Syntax
    Public Function New( _
       ByVal type As AssociationType, _
       ByVal fromElement As Element, _
       ByVal toElement As Element _
    )

    Parameters

    type
    The type of association between fromElement and toElement.
    fromElement
    toElement
    Exceptions
    Remarks
    Example
    Add or delete an association between Telecom elements in the utility network
    await QueuedTask.Run(() =>
    {
      using (NetworkSource junctionNetworkSource = telecomDomainNetwork.NetworkSources.FirstOrDefault(ns => ns.Name.Contains("TelcoDevice")))
      using (NetworkSource edgeNetworkSource = telecomDomainNetwork.NetworkSources.FirstOrDefault(ns => ns.Name.Contains("TelcoEdgeObject")))
      {
        TelecomElement junction = utilityNetwork.CreateElement(junctionNetworkSource.GetAssetGroup("Fiber").GetAssetType("Fiber"),
                  new Guid("CCFCF5DE-5B90-4FD9-A459-2F2E88107532")) as TelecomElement;
    
        TelecomElement edgeObject = utilityNetwork.CreateElement(edgeNetworkSource.GetAssetGroup("Fiber").GetAssetType("Fiber"),
                  new Guid("838B4A2B-8531-499D-8DCF-8567901D43D9")) as TelecomElement;
    
        Association association = new Association(AssociationType.JunctionEdgeObjectConnectivityMidspan, junction, edgeObject, 0.3);
    
        // Create the association from the port to the fiber.
        geodatabase.ApplyEdits(() =>
              {
                utilityNetwork.AddAssociation(association);
              });
        // Delete the association
        geodatabase.ApplyEdits(() =>
              {
                utilityNetwork.DeleteAssociation(association);
              });
      }
    
    });
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also