ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data.DDL Namespace / CodedValueDomainDescription Class / CodedValueDomainDescription Constructor / CodedValueDomainDescription Constructor(CodedValueDomain)
The ArcGIS.Core.Data.CodedValueDomain that the description object is representing.
Example

In This Topic
    CodedValueDomainDescription Constructor(CodedValueDomain)
    In This Topic
    Creates a description object of the ArcGIS.Core.Data.CodedValueDomain.
    Syntax
    public CodedValueDomainDescription( 
       CodedValueDomain codedValueDomain
    )
    Public Function New( _
       ByVal codedValueDomain As CodedValueDomain _
    )

    Parameters

    codedValueDomain
    The ArcGIS.Core.Data.CodedValueDomain that the description object is representing.
    Exceptions
    ExceptionDescription
    codedValueDomain is null.
    Example
    Delete Domain on KG Schemas with SchemaBuilder
    await QueuedTask.Run(() =>
    {
      using (var kg = GetKnowledgeGraph())
      {
        if (kg == null)
          return;
    
        //Get all the domains in the KG
        var domains = kg.GetDomains();
        var sb = new SchemaBuilder(kg);
    
        foreach (var domain in domains)
        {
          //skip the special provenance domain
          var name = domain.GetName();
          if (string.Compare(name, "esri__provenanceSourceType", true) == 0)
            continue;//skip this one
    
          //Delete all other domains
          if (domain is RangeDomain rd)
            sb.Delete(new RangeDomainDescription(rd));
          else if (domain is CodedValueDomain cvd)
            sb.Delete(new CodedValueDomainDescription(cvd));
        }
    
        try
        {
          //note: will throw an InvalidOperationException if there are no operations
          //to run. Will also delete associated fields dependent on deleted domain(s)
          if (!kg.ApplySchemaEdits(sb))
          {
            var err_msg = string.Join(",", sb.ErrorMessages.ToArray());
            System.Diagnostics.Debug.WriteLine($"Delete domains error: {err_msg}");
          }
        }
        catch (Exception ex)
        {
          System.Diagnostics.Debug.WriteLine(ex.ToString());
        }
      }
    });
    
    Delete Domain on KG Schemas with SchemaBuilder
    await QueuedTask.Run(() =>
    {
      using (var kg = GetKnowledgeGraph())
      {
        if (kg == null)
          return;
    
        //Get all the domains in the KG
        var domains = kg.GetDomains();
        var sb = new SchemaBuilder(kg);
    
        foreach (var domain in domains)
        {
          //skip the special provenance domain
          var name = domain.GetName();
          if (string.Compare(name, "esri__provenanceSourceType", true) == 0)
            continue;//skip this one
    
          //Delete all other domains
          if (domain is RangeDomain rd)
            sb.Delete(new RangeDomainDescription(rd));
          else if (domain is CodedValueDomain cvd)
            sb.Delete(new CodedValueDomainDescription(cvd));
        }
    
        try
        {
          //note: will throw an InvalidOperationException if there are no operations
          //to run. Will also delete associated fields dependent on deleted domain(s)
          if (!kg.ApplySchemaEdits(sb))
          {
            var err_msg = string.Join(",", sb.ErrorMessages.ToArray());
            System.Diagnostics.Debug.WriteLine($"Delete domains error: {err_msg}");
          }
        }
        catch (Exception ex)
        {
          System.Diagnostics.Debug.WriteLine(ex.ToString());
        }
      }
    });
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also