ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Data.DDL Namespace / SchemaBuilder Class / Delete Method
Indicates the object to be deleted.
Example

In This Topic
    Delete Method (SchemaBuilder)
    In This Topic
    Enqueue the delete operation on the object with the name referred to by the Description.
    Syntax
    public void Delete( 
       Description description
    )
    Public Sub Delete( _
       ByVal description As Description _
    ) 

    Parameters

    description
    Indicates the object to be deleted.
    Exceptions
    ExceptionDescription
    description is null.
    Remarks
    When deleting domains, a CodedValueDomainDescription must be used to delete a ArcGIS.Core.Data.CodedValueDomain and a RangeDomainDescription must be used to delete a ArcGIS.Core.Data.RangeDomain.
    Example
    Deleting a Table
    public void DeleteTableSnippet(Geodatabase geodatabase, Table table)
    {
      // Create a TableDescription object
      TableDescription tableDescription = new TableDescription(table.GetDefinition());
    
      // Create a SchemaBuilder object
      SchemaBuilder schemaBuilder = new SchemaBuilder(geodatabase);
    
      // Add the deletion of the table to our list of DDL tasks
      schemaBuilder.Delete(tableDescription);
    
      // Execute the DDL
      bool success = schemaBuilder.Build();
    }
    Deleting a Feature Class
    public void DeleteFeatureClassSnippet(Geodatabase geodatabase, FeatureClass featureClass)
    {
      // Create a FeatureClassDescription object
      FeatureClassDescription featureClassDescription = new FeatureClassDescription(featureClass.GetDefinition());
    
      // Create a SchemaBuilder object
      SchemaBuilder schemaBuilder = new SchemaBuilder(geodatabase);
    
      // Add the deletion fo the feature class to our list of DDL tasks
      schemaBuilder.Delete(featureClassDescription);
    
      // Execute the DDL
      bool success = schemaBuilder.Build();
    }
    Deleting a FeatureDataset
    public void DeleteFeatureDatasetSnippet(Geodatabase geodatabase)
    {
      // Deleting a FeatureDataset named as 'Parcel_Information'
    
      FeatureDatasetDefinition featureDatasetDefinition = geodatabase.GetDefinition<FeatureDatasetDefinition>("Parcel_Information");
      FeatureDatasetDescription featureDatasetDescription =
        new FeatureDatasetDescription(featureDatasetDefinition);
    
      SchemaBuilder schemaBuilder = new SchemaBuilder(geodatabase);
    
      // Delete an existing feature dataset named as 'Parcel_Information'
      schemaBuilder.Delete(featureDatasetDescription);
      schemaBuilder.Build();
    }
    Removing attribute index
    public void RemoveAttributeIndex(SchemaBuilder schemaBuilder, FeatureClassDefinition featureClassDefinition, string attributeIndexName)
    {
      // Find a index to be removed 
      ArcGIS.Core.Data.Index indexToRemove = featureClassDefinition.GetIndexes().First(f => f.GetName().Equals(attributeIndexName));
    
      // Index description of the index to be removed 
      AttributeIndexDescription indexDescriptionToRemove = new AttributeIndexDescription(indexToRemove, new TableDescription(featureClassDefinition));
    
      // Enqueue the DDL operation to remove index 
      schemaBuilder.Delete(indexDescriptionToRemove);
    
      // Execute the delete index operation
      bool isDeleteIndexSuccess = schemaBuilder.Build();
    }
    Removing spatial index
    public void RemoveSpatialIndex(SchemaBuilder schemaBuilder, FeatureClassDefinition featureClassDefinition)
    {
      // Create a spatial description  
      SpatialIndexDescription spatialIndexDescription = new SpatialIndexDescription(new FeatureClassDescription(featureClassDefinition));
    
      // Enqueue the DDL operation to remove index 
      schemaBuilder.Delete(spatialIndexDescription);
    
      // Execute the delete index operation
      bool isDeleteIndexSuccess = schemaBuilder.Build();
    }
    Delete domain
    public void DeleteDomain(Geodatabase geodatabase, string domainNameToBeDeleted = "PipeMaterial")
    {
      SchemaBuilder schemaBuilder = new SchemaBuilder(geodatabase);
      CodedValueDomain codedValueDomain = geodatabase.GetDomains().First(f => f.GetName().Equals(domainNameToBeDeleted)) as CodedValueDomain;
      CodedValueDomainDescription codedValueDomainDescription = new CodedValueDomainDescription(codedValueDomain);
    
      // Deleting a coded value domain
      schemaBuilder.Delete(codedValueDomainDescription);
      schemaBuilder.Build();
    }
    Deleting a relationship class
    public void DeleteRelationshipClass(SchemaBuilder schemaBuilder, RelationshipClassDefinition relationshipClassDefinition)
    {
      schemaBuilder.Delete(new RelationshipClassDescription(relationshipClassDefinition));
      schemaBuilder.Build();
    }
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also