Click or drag to resize

OperationServiceExtensionsExecuteContinuousOperationT Method (IOperationService, 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.Extensions
Assembly:  Resto.Front.Api.V6 (in Resto.Front.Api.V6.dll)
Syntax
C#
public static T ExecuteContinuousOperation<T>(
	this IOperationService operationService,
	Func<IOperationService, T> continuousOperation
)

Parameters

operationService
Type: Resto.Front.ApiIOperationService
Operation service.
continuousOperation
Type: SystemFuncIOperationService, T
Callback to be executed continuously.

Type Parameters

T

Return Value

Type: T

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IOperationService. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
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