Skip to content

AsyncToSyncListBehaviorWrapper class

namespace: Serenity.Services   assemblySerenity.Net.Services

Wraps an IListBehaviorAsync implementation and exposes it as an IListBehaviorSync by blocking on its async methods. This allows synchronous list request handlers to run asynchronous list behaviors.

public class AsyncToSyncListBehaviorWrapper : IListBehaviorSync, IWrappedBehavior

Public Members

name description
AsyncToSyncListBehaviorWrapper(…) Wraps an IListBehaviorAsync implementation and exposes it as an IListBehaviorSync by blocking on its async methods. This allows synchronous list request handlers to run asynchronous list behaviors.
WrappedBehavior { get; }
OnAfterExecuteQuery(…)
OnApplyFilters(…)
OnBeforeExecuteQuery(…)
OnPrepareQuery(…)
OnReturn(…)
OnValidateRequest(…)

Remarks

A behavior instance is always cached and reused across requests, so make sure you don't store anything in private variables, and its operation is thread-safe. If you need to pass some state between events, use handler's StateBag.

See Also