Click or drag to resize

IOperationServiceExecuteContinuousOperationT Method (FuncIOperationService, T)

Executes the callback function as one continuous operation by providing temporary instance of IOperationService, which holds internal locks taken on lockable entities (such as order) until the operation ends. It's strongly recommended to avoid potentially obstructive calls in the callback, i.e network calls, heavy I/O or CPU-bound calls, thread blocking and so on, because touched entities will remain locked for a long time.

Namespace:  Resto.Front.Api
Assembly:  Resto.Front.Api.V8 (in Resto.Front.Api.V8.dll)
Syntax
C#
T ExecuteContinuousOperation<T>(
	Func<IOperationService, T> continuousOperation
)

Parameters

continuousOperation
Type: SystemFuncIOperationService, T
Callback to be executed continuously.

Type Parameters

T

Return Value

Type: T
Remarks
It could be useful for calling several methods of the local IOperationService instance sequentially when it's important to call them one by one without outside changes. While all committed changes will immediately become visible for everyone, no one except of the provided callback will be allowed to alter entities which were touched via that short-living IOperationService (input argument of the callback). For example, you can create a new order and add there guests, products and external prepay using one edit session, but you cannot print order items or process external prepay in the same session, because these operations can't be rolled back and thus aren't available via IEditSession. Executing these operations separately on a global Operations isn't reliable because there is a chance to be interrupted by a user, other plugin or background entity change handlers, which may prevent further our edits by applying conflicting changes or by locking an entity for a long time.
See Also