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

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

    Parameters

    rangeDomain
    The ArcGIS.Core.Data.RangeDomain that the description object is representing.
    Exceptions
    ExceptionDescription
    rangeDomain 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