IWorkspace Interface

Provides access to members that have information about the workspace.

Members

Name Description
Read-only property ConnectionProperties The connection properties of the workspace.
Read-only property DatasetNames The DatasetNames in the workspace.
Read-only property Datasets The datasets in the workspace.
Method ExecuteSQL Executes the specified SQL statement.
Method Exists Checks if the workspace exists.
Method IsDirectory TRUE if the workspace is a file system directory.
Read-only property PathName The file system full path of the workspace.
Read-only property Type The Type of the Workspace.
Read-only property WorkspaceFactory The factory that created the workspace.

IWorkspace.ConnectionProperties Property

The connection properties of the workspace.

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

Remarks

The ConnectionPropertiesproperty of a workspace returns the set of named connection properties for this workspace.

IWorkspace.DatasetNames Property

The DatasetNames in the workspace.

Public Function get_DatasetNames ( _
    ByVal DatasetType As esriDatasetType _
) As IEnumDatasetName
public IEnumDatasetName get_DatasetNames (
    esriDatasetType DatasetType
);

Remarks

The DatasetNamesmethod returns an enumerator over the dataset names in the workspace for the specified dataset type. Name objects are lightweight versions of the geodatabase objects they refer to while still providing access to some of the properties/methods available in the geodatabase object. From a name object an instance of the geodatabase object specified by the name object can be created/returned and vice versa.

See esriDatasetType for more information on dataset types.

Browsing applications should use the DatasetNamesmethod to obtain name objects. These dataset name objects contain the essential properties of the corresponding dataset objects and are faster to retrieve. If the actual dataset specified by a name object is required (for example, because the user selected it), then it can easily be instantiated by calling the Openmethod on the name object.

Using a dataset type of esriDTAnywill return all the datasets or dataset names in the workspace, across all dataset types. Note that only the top-level datasets in the workspace are returned by these methods. In particular, if a workspace contains both stand-alone feature classes and additional feature classes that are part of a feature dataset, then calling the DatasetNamesproperty on the workspace with a dataset type of esriDTFeatureClasswill return only the standalone feature classes. In order to get the feature class names within a feature dataset, the application needs to get the FeatureClassNamesproperty on the top-level feature dataset name returned by the workspace.

IWorkspace.Datasets Property

The datasets in the workspace.

Public Function get_Datasets ( _
    ByVal DatasetType As esriDatasetType _
) As IEnumDataset
public IEnumDataset get_Datasets (
    esriDatasetType DatasetType
);

Remarks

The Datasetsmethod returns an enumerator over the datasets in the workspace of the specified dataset type. Not to be confused with DatasetNames, Datasetswill return a fully hydrated dataset object.

See esriDatasetType for more information on dataset types.

Using a dataset type of esriDTAnywill return all the datasets or datasets in the workspace, across all dataset types. Note that only the top-level datasets in the workspace are returned by these methods. In particular, if a workspace contains both stand-alone feature classes and additional feature classes that are part of a feature dataset, then calling the Datasetsproperty on the workspace with a dataset type of esriDTFeatureClasswill return only the standalone feature classes.

IWorkspace.ExecuteSQL Method

Executes the specified SQL statement.

Public Sub ExecuteSQL ( _
    ByVal sqlStmt As String _
)
public void ExecuteSQL (
    string sqlStmt
);

Remarks

The ExecuteSQLmethod can be used to send an arbitrary SQL statement to the underlying database for execution. The statement can be any DDL (data definition language) or DML (data manipulation language) statement but can not return any result sets. The syntax for the SQL is as required by the underlying database. The workspace supports an optional ISQLSyntaxinterface that provides information to applications on aspects of the SQL Syntax for the underlying database.

To determine if a workspace supports the ExecutesSQLmethod, an application can check the value of the canExecuteSQLworkspaceproperty via the optional IWorkspacePropertiesinterface. In general, this method is only supported on local and remote database workspaces.

IWorkspace.Exists Method

Checks if the workspace exists.

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

Remarks

This method can be used with workspaces from file-based data sources to detect if they've been deleted by another application. For example, a shapefile workspace is a directory and can be deleted while the workspace is open.

IWorkspace.IsDirectory Method

TRUE if the workspace is a file system directory.

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

IWorkspace.PathName Property

The file system full path of the workspace.

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

Remarks

If a remote workspace is opened using connection properties, this will be empty.

IWorkspace.Type Property

The Type of the Workspace.

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

Remarks

See esriWorkspaceType for information on the types of workspaces.

IWorkspace.WorkspaceFactory Property

The factory that created the workspace.

Public ReadOnly Property WorkspaceFactory As IWorkspaceFactory
public IWorkspaceFactory WorkspaceFactory {get;}

Remarks

The WorkspaceFactoryproperty can be used to get a reference back to the workspace factory for this workspace.

Classes that implement IWorkspace

Classes Description
BimFileWorkspace (esriDataSourcesFile) Esri BIM File Workspace
ParquetFileWorkspace (esriDataSourcesFile) Parquet File Workspace
RasterWorkspace (esriDataSourcesRaster) The raster workspace object.
SqlWorkspace (esriDataSourcesGDB) Sql workspace
Workspace Workspace Object.

Remarks

A Workspaceis a container of spatial and non-spatial datasets such as feature classes, raster datasets, and tables. It provides methods to instantiate existing datasets and to create new datasets. Workspacesare classified into types specified by the esriWorkspaceTypeenumerator; FileSystemWorkspace, LocalDatabaseWorkspace, and RemoteDatabaseWorkspace.

Shapefiles and ArcGIS for Desktop Advanced workspaces are examples of FileSystemWorkspace. A personal geodatabase stored in an Access or a File Geodatabase is an example of a LocalDatabaseWorkspace. A geodatabase stored in an RDBMS such as Oracle, DB2, SqlServer, or Informix and accessed via ArcSDE is an example of a RemoteDatabaseWorkspace.

The WorkspaceNamefor a workspace can be persisted, for example, in a map document. An application can call the Openmethod on the workspace name after loading it from persistent storage in order to connect to and get an object reference to the workspace. A WorkspaceNamename object can be returned from a workspace through the use of IDataset.FullName.

The IWorkspaceinterface provides methods for accessing various properties of a workspace, such as its connection properties, and the collection of datasets it contains.

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