ILockApiLockAndCheck Method
|
Execute the lock context and verify the query. If the query result is not found, throw an exception and release the lock context.
Namespace: Casewhere.Runtime.DSL.ApiAssembly: Casewhere.Runtime (in Casewhere.Runtime.dll) Version: 2.8.5.0
Syntaxvoid LockAndCheck(
string lockId,
DataSourceApiQuery query,
TimeSpan waitingTime,
TimeSpan expiredTime
)
Parameters
- lockId String
- id of lock context
- query DataSourceApiQuery
- The search query
- waitingTime TimeSpan
- The timeout of waiting for lock context
- expiredTime TimeSpan
- The timeout of lock context
Return Value
Examplevar lockApi = ctx.Use<ILockApi>();
var objectId = "data object id";
var lockId = "key of lock context";
var expiredTime = TimeSpan.FromSeconds(30);
var waitingTime = TimeSpan.Zero;
var filter = FilterBuilder.Create().Eq("DepartmentId", ctx.Input.Id).Eq("Active", true).Build();
var query = DataSourceApiQuery.For("Employee")
.FilterBy(filter)
.ProjectOn("FirstName", "LastName")
.OrderBy("FirstName", true);
lockApi.LockAndCheck(lockId, query, waitingTime, expiredTime);
lockApi.Release(lockId);
See Also