Locks an object. Throws an exception if the object is already locked. Throws an exception if the object is not been saved. Because it is possible that between calling IsLocked and calling Lock another user may have locked the object. Therefore, it is recommended calling Lock and then trapping the Exceptions.ObjectAlreadyExistsException to determine whether the object is already locked.

Namespace: DatabaseObjects
Assembly: DatabaseObjects (in DatabaseObjects.dll) Version: 3.8.1.0

Syntax

C#
public void Lock(
	IDatabaseObjects objCollection,
	IDatabaseObject objObject
)
Visual Basic
Public Sub Lock ( _
	objCollection As IDatabaseObjects, _
	objObject As IDatabaseObject _
)
Visual C++
public:
void Lock(
	IDatabaseObjects^ objCollection, 
	IDatabaseObject^ objObject
)

Parameters

objCollection
Type: DatabaseObjects..::..IDatabaseObjects

[Missing <param name="objCollection"/> documentation for "M:DatabaseObjects.DatabaseObjectLockController.Lock(DatabaseObjects.IDatabaseObjects,DatabaseObjects.IDatabaseObject)"]

objObject
Type: DatabaseObjects..::..IDatabaseObject

[Missing <param name="objObject"/> documentation for "M:DatabaseObjects.DatabaseObjectLockController.Lock(DatabaseObjects.IDatabaseObjects,DatabaseObjects.IDatabaseObject)"]

Exceptions

ExceptionCondition
DatabaseObjects.Exceptions..::..DatabaseObjectsExceptionThrown if the object has not been saved.
DatabaseObjects.Exceptions..::..ObjectAlreadyExistsExceptionThrown if the object has already been locked.

See Also