Show / Hide Table of Contents

Method AddAssociationAsync

AddAssociationAsync(UtilityAssociation)

Adds an association between two utility elements in this utility network.

Declaration
public Task AddAssociationAsync(UtilityAssociation association)
Parameters
Type Name Description
UtilityAssociation association

The association to add.

Returns
Type Description
System.Threading.Tasks.Task

A System.Threading.Tasks.Task that has no return value.

One of the following exceptions may be set on the returned System.Threading.Tasks.Task:

  • System.InvalidOperationException, if this method is called on a utility network schema version that does not support the association type.
  • GeodatabaseClosedException, if this method is called after the geodatabase is closed.
  • System.ArgumentException, when the specified association:
    • includes an element that is not accessible or does not belong in this utility network.
    • has a FromElement that lacks the necessary role for the association type.
    • type is connectivity and includes an element without a terminal or its default terminal could not be determined.
    • is not supported by any utility rule.

Remarks

Adding an association may also update the features that participate in the association.

Use CanAddAssociationAsync(UtilityAssociation) to determine if you can successfully add this association.

This method requires that:

  • The association type is supported by the utility network schema. Note that SchemaVersion less than 4 does not support the following association types:
    • JunctionEdgeObjectConnectivityFromSide
    • JunctionEdgeObjectConnectivityMidspan
    • JunctionEdgeObjectConnectivityToSide
  • The association elements are accessible. Use IsValid to check feature accessibility to ensure it has not been filtered out.
  • The FromElement has the necessary role for the association type. A Container can participate in a containment association or a Structure can participate in a structural attachment association.
  • If the association's type is Connectivity, the Terminal must be set for elements with more than one terminal available in the Terminals
  • The association is supported by a utility rule. Use GetRulesAsync(IEnumerable<UtilityAssetType>, CancellationToken) to determine if the AssociationType can be made between the FromElement and ToElement using their corresponding AssetType.

See Also
DeleteAssociationAsync(UtilityAssociation)
DeleteAssociationsAsync(IEnumerable<UtilityAssociation>)

Applies to

Platforms and versions
TargetVersions
.NET Standard 2.0200.5 - 200.7
.NET200.5 - 200.7
.NET Windows200.5 - 200.7
.NET Android200.5 - 200.7
.NET iOS200.5 - 200.7
.NET Framework200.5 - 200.7
UWP200.5 - 200.7
In This Article
Back to top Copyright © 2022 Esri.