IDataset Interface

Provides access to members that supply dataset information.

Description

The IDataset interface is the main interface used to manage a dataset.

Members

Name Description
Read/write property BrowseName The browse name of the dataset.
Method CanCopy True if this dataset can be copied.
Method CanDelete True if this dataset can be deleted.
Method CanRename True if this dataset can be renamed.
Read-only property Category The category of the dataset.
Method Copy Copies this dataset to a new dataset with the specified name.
Method Delete Deletes this dataset.
Read-only property FullName The associated name object.
Read-only property Name The name of the Dataset.
Read-only property PropertySet The set of properties for the dataset.
Method Rename Renames this Dataset.
Read-only property Subsets Datasets contained within this dataset.
Read-only property Type The type of the Dataset.
Read-only property Workspace The workspace containing this dataset.

IDataset.BrowseName Property

The browse name of the dataset.

Public Property BrowseName As String
public string BrowseName {get; set;}

Remarks

BrowseName returns file names without their extension. For example, States.shp would appear as States.

IDataset.CanCopy Method

True if this dataset can be copied.

Public Function CanCopy ( _
) As Boolean
public bool CanCopy (
);

Remarks

The CanCopy, CanDelete, and CanRename properties are meant to be used in conjunction with the Copy, Delete, and Rename methods and signify whether a dataset is supported by these methods. For example, you may not delete a network feature class nor can you use the Copy method on a Geodatabase feature class. To copy Geodatabase datasets, including feature classes, geometric networks, topologies, etc., use the IGeoDBDataTransfer interface.

The CanCopy method is supported by:

  • CAD Drawings
  • Coverages
  • DBase Tables
  • Info Tables
  • Raster Datasets
  • SDC datasets
  • SDC Network Datasets
  • Shapefiles
  • Shapefile Network Datasets

IDataset.CanDelete Method

True if this dataset can be deleted.

Public Function CanDelete ( _
) As Boolean
public bool CanDelete (
);

Remarks

The CanCopy, CanDelete, and CanRenameproperties are meant to be used in conjunction with the Copy, Delete, and Renamemethods and signify whether a dataset is supported by these methods. For example, you may not delete a network feature class nor can you use the Copy method on a Geodatabase feature class. To copy Geodatabase datasets, including feature classes, geometric networks, topologies, etc., use the IGeoDBDataTransfer interface.

IDataset.CanRename Method

True if this dataset can be renamed.

Public Function CanRename ( _
) As Boolean
public bool CanRename (
);

Remarks

The CanCopy, CanDelete, and CanRenameproperties are meant to be used in conjunction with the Copy, Delete, and Renamemethods and signify whether a dataset is supported by these methods. For example, you may not delete or rename a network feature class nor can you use the Copy method on a Geodatabase feature class. To copy Geodatabase datasets, including feature classes, geometric networks, topologies, etc., use the IGeoDBDataTransfer interface.

IDataset.Category Property

The category of the dataset.

Public ReadOnly Property Category As String
public string Category {get;}

Remarks

IDataset::Category returns a description of the category of the dataset. The description returned from the Category property is the same value that is displayed in the Type column within the Contents tab in ArcCatalog. The value will contain a description of the dataset such as "Topology" prefixed with a description of the type of workspace containing the dataset such as "File Geodatabase".

The description returned from IDataset::Category may change between releases of ArcGIS. In addition to this, returned strings are localized, meaning that code relying on a specific string being provided may fail when deployed with a different version of ArcGIS than it was developed with, or when deployed to a client using a different language than it was developed with.

IDataset.Copy Method

Copies this dataset to a new dataset with the specified name.

Public Function Copy ( _
    ByVal copyName As String, _
    ByVal copyWorkspace As IWorkspace _
) As IDataset
public IDataset Copy (
    string copyName,
    IWorkspace copyWorkspace
);

Remarks

IDataset::Copy should only be used with datasets from file-based data sources, such as shapefiles and coverages.

IDataset.Delete Method

Deletes this dataset.

Public Sub Delete ( _
)
public void Delete (
);

Errors Returned

FDO_E_FEATURECLASS_NETWORK_CANNOT_DELETE

The feature class is in a geometric network and cannot be deleted until the geometric network is deleted.

FDO_E_FEATURECLASS_TOPOLOGY_CANNOT_DELETE

The feature class is in a topology and cannot be deleted until the topology is deleted.

FDO_E_OBJECT_IS_DELETED

The feature class has either already been deleted or it has been moved into or out of a feature dataset.

Functional License Check

If your application/site is not appropriately licensed, Delete can return an error of FDO_E_NO_OPERATION_LICENSE.

Remarks

Certain feature classes, such as network and topology feature classes, cannot be deleted until their containing objects are deleted.

IDataset.FullName Property

The associated name object.

Public ReadOnly Property FullName As IName
public IName FullName {get;}

Remarks

The FullNameproperty returns a Nameobject for the dataset. The Nameobject can be persisted and provides a way to get back to the dataset in a future session of the application, via the Openmethod on the Name object.

IDataset.Name Property

The name of the Dataset.

Public ReadOnly Property Name As String
public string Name {get;}

IDataset.PropertySet Property

The set of properties for the dataset.

Public ReadOnly Property PropertySet As IPropertySet
public IPropertySet PropertySet {get;}

Description

The PropertySet property is used to return any additional intrinsic properties (but not metadata properties) that may apply to the dataset. One use of this property is to distinguish between the types of File Geodatabase datafile formats. If called on a Feature Class or Table in a File Geodatabase the Datafile Format property can either be esriFGDBStandardDatafile or esriFGDBCompressedDatafile.

Most datasets do not implement this property and will either raise an error or return a null value if it's called. There are a handful of exceptions that will return property sets; these include the datasets from file geodatabases (as mentioned above) and coverages.

Remarks

Examples of intrinsic properties for which explicit methods exist include the SpatialReference and the Extent methods available on the IGeoDataset interface. In most cases this PropertySet will be empty.

IDataset::PropertySet is not supported for Graph objects such as a Geometric Network.

IDataset.Rename Method

Renames this Dataset.

Public Sub Rename ( _
    ByVal Name As String _
)
public void Rename (
    string Name
);

Remarks

IDataset::Rename does not support the renaming of Graph objects such as a Geometric Network. In addition, certain feature classes, such as network feature classes, cannot be renamed.

IDataset.Subsets Property

Datasets contained within this dataset.

Public ReadOnly Property Subsets As IEnumDataset
public IEnumDataset Subsets {get;}

Description

The Subsetsproperty returns other Dataset objects contained in this dataset.

Errors Returned

Calling IDataset::Subsets on a dataset after the IWorkspaceEvents::OnDeleteDataset event has fired is not recommended as it may return an error or an empty enumeration of datasets. IFeatureClassContainer::Classes should be used instead.

Remarks

IDataset::Subsetsis not supported for Graph objects such as a Geometric Network. To return the feature classes contained in a Geometric Network, use the IFeatureClassContainer interface.

IDataset.Type Property

The type of the Dataset.

Public ReadOnly Property Type As esriDatasetType
public esriDatasetType Type {get;}

Remarks

The Type property returns the an esriDatasetType value indicating the dataset type, such as esriDTTable or esriDTFeatureClass.

IDataset.Workspace Property

The workspace containing this dataset.

Public ReadOnly Property Workspace As IWorkspace
public IWorkspace Workspace {get;}

Description

The Workspaceproperty returns the containing workspace for this dataset.

Errors Returned

FDO_E_NOT_SUPPORTED

Will be returned if this property is accessed on a workspace object.

Classes that implement IDataset

Classes Description
AttributedRelationshipClass Esri Attributed Relationship Class object.
BimFileWorkspace (esriDataSourcesFile) Esri BIM File Workspace
FeatureClass Esri Feature Class object.
FunctionRasterDataset (esriDataSourcesRaster) A class for a function raster dataset.
MemoryRelationshipClass A relationship class object that is stored in memory.
ObjectClass Esri Object Class object.
ParquetFileWorkspace (esriDataSourcesFile) Parquet File Workspace
RasterBand (esriDataSourcesRaster) A representation of a single band of a raster dataset on disk.
RasterCatalog A collection of raster datasets in a Geodatabase table.
RasterDataset (esriDataSourcesRaster) A representation of a raster dataset on disk.
RasterWorkspace (esriDataSourcesRaster) The raster workspace object.
RelationshipClass Esri Relationship Class object.
RelQueryTable An object that joins two datasets based on common data values.
SqlWorkspace (esriDataSourcesGDB) Sql workspace
Table Esri Table object.
Tin The Esri TIN component.
Workspace Workspace Object.
XYEventSource XY event source object.

Remarks

Not all of the methods and properties of IDataset are applicable to every type of dataset. For example, the Copy method should only be used on datasets from file-based data sources, and very few datasets will return values from the PropertySet property (coverages being a notable exception).

// Get the Utility Network dataset from a map server

private void GetUtilityNetworkDataset()

{

  MapServer mapService = (MapServer)serverObjectHelper.ServerObject;

  IMapServerDataAccess mapServerDataAccess = (IMapServerDataAccess)serverObjectHelper.ServerObject;



  // Check if this service contains a Utility Network layer

  var unLayerInfo = GetUNLayerInfo(mapService);

  if (unLayerInfo != null)

  {

    // Get the Utility Network dataset

    IDataset unDataset = (IDataset)mapServerDataAccess.GetDataSource(mapService.DefaultMapName, unLayerInfo.ID);



    logger.LogMessage(ServerLogger.msgType.infoStandard, soe_name + ".init()", 200, "UN dataset found: " + unDataset.Name);

  }

}



private IMapLayerInfo GetUNLayerInfo(IMapServer mapService)

{

  IMapServerInfo mapServerInfo = mapService.GetServerInfo(mapService.DefaultMapName);

  IMapLayerInfos layerInfos = mapServerInfo.MapLayerInfos;



  for (int i = 0; i < layerInfos.Count; i++)

  {

    IMapLayerInfo layerInfo = layerInfos.Element[i];

    if (layerInfo.Type.Equals("Utility Network Layer", StringComparison.OrdinalIgnoreCase))

    {

      return layerInfo;

    }

  }

  return null;

}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.