Interface IWorkspaceFactory
- Namespace
- ESRI.ArcGIS.Geodatabase
- Assembly
- ESRI.Server.Geodatabase.dll
Provides access to members that create and open workspaces and supply workspace factory information.
[Guid("F173FC16-D63A-11D1-AA81-00C04FA33A15")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWorkspaceFactory
Remarks
A WorkspaceFactory is a dispenser of workspaces and allows a client to connect to a workspace specified by a set of connection properties. A workspace represents a database or a datasource that contains one or more datasets. Examples of datasets include tables, feature classes and relationship classes. A WorkspaceFactory is a cocreatable, singleton object. Connection properties are specified using a PropertySet object and can be saved to a connection file. A WorkspaceFactory also supports methods that can be used to browse and manage file system workspaces, and methods to manage connection files for remote database workspaces.
Properties
WorkspaceDescription[bool]
A singular or plural description of the type of workspace the workspace factory opens/creates.
string WorkspaceDescription[bool plural] { get; }
Parameters
pluralbool
Property Value
Remarks
WorkspaceType
The type of workspace the workspace factory opens/creates.
esriWorkspaceType WorkspaceType { get; }
Property Value
Remarks
Methods
ContainsWorkspace(string, IFileNames)
Indicates if parentDirectory contains a valid workspace, or is a valid file-system workspace.
bool ContainsWorkspace(string parentDirectory, IFileNames fileNames)
Parameters
parentDirectorystringfileNamesIFileNames
Returns
Remarks
Copy(IWorkspaceName, string, out IWorkspaceName)
Copies a workspace to the specified destination folder.
bool Copy(IWorkspaceName WorkspaceName, string destinationFolder, out IWorkspaceName workspaceNameCopy)
Parameters
WorkspaceNameIWorkspaceNamedestinationFolderstringworkspaceNameCopyIWorkspaceName
Returns
Remarks
The Copy and Move methods can be used to copy or move workspaces or connection files between folders in the file system. The Boolean result indicates if the operation was successful. In the case of remote database workspaces, these operations work on the connection file representing the workspace.
Create(string, string, IPropertySet, int)
Creates a new workspace specified by the directory, file name, and connection properties.
IWorkspaceName Create(string parentDirectory, string Name, IPropertySet ConnectionProperties, int hWnd)
Parameters
parentDirectorystringNamestringConnectionPropertiesIPropertySethWndint
Returns
Remarks
GetClassID()
The class ID of the WorkspaceFactory.
UID GetClassID()
Returns
Remarks
GetClassID returns the unique identifier for the workspace factory. You can use this to distinguish different versions of the same type of factory, for example, whether you are working with an SDEWorkspace, FileGDBWorkspace or AccessWorkspace factory.
GetWorkspaceName(string, IFileNames)
Retrieves the workspace name of a workspace from the given list of file names.
IWorkspaceName GetWorkspaceName(string parentDirectory, IFileNames fileNames)
Parameters
parentDirectorystringfileNamesIFileNames
Returns
Remarks
GetWorkspaceName is useful when browsing the file system for workspaces. It is handed in a parent directory and the list of file names in the directory to be examined. It returns a WorkspaceName object representing the first workspace it finds in the list of filenames and removes any filenames representing the workspace from the input list of filenames.
IsWorkspace(string)
True if the specified file identifies a workspace supported by the workspace factory.
bool IsWorkspace(string fileName)
Parameters
fileNamestring
Returns
Move(IWorkspaceName, string)
Moves a workspace to the specified destination folder.
bool Move(IWorkspaceName WorkspaceName, string destinationFolder)
Parameters
WorkspaceNameIWorkspaceNamedestinationFolderstring
Returns
Remarks
The Copy and Move methods can be used to copy or move workspaces or connection files between folders in the file system. The Boolean result indicates if the operation was successful. In the case of remote database workspaces, these operations work on the connection file representing the workspace.
Open(IPropertySet, int)
Opens the workspace specified by the connection properties.
IWorkspace Open(IPropertySet ConnectionProperties, int hWnd)
Parameters
ConnectionPropertiesIPropertySethWndint
Returns
Remarks
Open takes as input a property set of connection properties that specify the workspace to connect to. In the case of file system workspaces and local database workspaces, a single property named DATABASE, whose value is the pathname to the workspace, is usually all that is required. In the case of remote database workspaces accessed via ArcSDE the properties can include the USER, PASSWORD, DATABASE, SERVER, INSTANCE, VERSION, HISTORICAL_NAME, HISTORICAL_TIMESTAMP, and AUTHENTICATION_MODE properties of the database being connected to.
List of acceptable connection property names and a brief description of each
"SERVER" – SDE server name you are connecting to.
"INSTANCE" – Instance you are connection to.
"DATABASE" – Database connected to.
"USER" – Connected user.
"PASSWORD" – Connected password.
"AUTHENTICATION_MODE" – Credential authentication mode of the connection. Acceptable values are "OSA" and "DBMS".
"VERSION" – Transactional version to connect to. Acceptable value is a string that represents a transaction version name.
"HISTORICAL_NAME" – Historical version to connect to. Acceptable value is a string type that represents a historical marker name.
"HISTORICAL_TIMESTAMP" – Moment in history to establish an historical version connection. Acceptable value is a date time that represents a moment timestamp.
Notes:
-
The "DATABASE" property is optional and is required for ArcSDE instances that manage multiple databases (for example, SQL Server).
-
If “AUTHENTICATION_MODE” is “OSA” then “USER” and “PASSWORD” are not required. “OSA” represents operating system authentication and uses the operating system credentials to establish a connection with the database.
-
Since the workspace connection can only represent one version only 1 of the 3 version properties (“VERSION” or “HISTORICAL_NAME” or “HISTORICAL_TIMESTAMP”) should be used.
-
The "VERSION" property is case sensitive and the correct case must be used when entering the version property.
OpenFromFile(string, int)
Opens the workspace specified by the given file name.
IWorkspace OpenFromFile(string fileName, int hWnd)
Parameters
Returns
Remarks
OpenFromFile takes the pathname of a file or directory that represents either a FileSystemWorkspace or LocalDatabaseWorkspace, or a connection file to a RemoteDatabase workspace and returns an interface on the specified workspace. Clients of these methods can then proceed to open and access datasets in the workspace. If these methods are called with insufficient properties, then the user will be presented with a connection dialog that will prompt for the required properties.
The hWnd argument is the parent window or application's window. The hWnd will guarantee that the connection dialog, if presented to you because of insufficient properties, has the correct parent.
ReadConnectionPropertiesFromFile(string)
The connection properties from the specified file.
IPropertySet ReadConnectionPropertiesFromFile(string fileName)
Parameters
fileNamestring
Returns
Remarks
The filename parameter represents the pathname of a file that contains the connection information to be placed into the IPropertySet variable.