Changes a schema lock.
[Visual Basic .NET]
Public Sub ChangeSchemaLock ( _
ByVal schemaLock As esriSchemaLock _
)
[C#]
public void ChangeSchemaLock (
esriSchemaLock schemaLock
);
[C++]
HRESULT ChangeSchemaLock(
esriSchemaLock schemaLock
);
[C++]
Parameters
schemaLock [in]
schemaLock is a parameter of type esriSchemaLock
Product Availability
Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.
Errors Returned
FDO_E_MUST_BE_OWNER: Returned when a user other than the owner of a dataset tries to acquire an exclusive schema lock.
Remarks
There are two kinds of schema locks: shared and exclusive. Shared schema locks are applied automatically by the geodatabase when accessing a dataset and are removed when all references to the dataset are removed. For this reason, it's not necessary to explicitly apply or remove shared schema locks. There is no limit to the number of shared schema locks a dataset or object can have at any given time.
In contrast to shared schema locks, exclusive schema locks are controlled by the developer or ArcGIS application, such as ArcMap or ArcCatalog. An exclusive lock is used to lock a geodatabase dataset or object from use by others to make the necessary changes to it. An exclusive lock is promoted from a shared lock and demoted back to a shared lock when no longer needed. The presence of additional shared schema locks on a dataset or object prevents an exclusive schema lock from being applied and precludes the ability to make changes to the underlying dataset and its schema while it is in use. Only one exclusive schema lock is allowed per dataset. As opposed to shared schema locks, exclusive schema locks are not applied or removed automatically; it is the responsibility of the developer to apply or remove exclusive schema locks.
Limit the scope of exclusive schema locks to the operation that requires the lock. Gather the necessary information to perform the action, obtain the exclusive lock, make the change, and release the lock. Some examples of operations for which an exclusive schema lock should be obtained include:
- Modifications to attribute domains, such as adding or removing values from a coded value domain or changing the range for range domains
- Adding or deleting a field from a feature class or object class
- Associating a class extension with a feature class
- Creating a topology, geometric network, network dataset, terrain, schematic dataset, representation, or cadastral fabric on a set of feature classes
- Any use of the IClassSchemaEdit interface
- Putting a feature class into and taking it out of load-only mode with the IFeatureClassLoad.LoadOnlyMode method
- Managing (creating, deleting, or modifying) spatial and attribute indexes
Once the action requiring an exclusive schema lock is complete, the exclusive schema lock must be demoted to a shared lock. This includes when errors are raised during the schema modification, for example, consider the case where a field is being deleted from a feature class. To delete the field, an exclusive schema lock is obtained. However, on the call to DeleteField, an error is thrown; that is, the field being deleted is a required field, such as the ObjectID field. In the handling of the error, the exclusive schema lock must be demoted to a shared lock before proceeding.
See Also
ISchemaLock Interface
.NET Samples
Tabbed feature inspector Get and set key properties on a mosaic dataset Tabbed feature inspector Timestamper class extension