Skip to content

SyncToAsyncRetrieveBehaviorWrapper class

namespace: Serenity.Services   assemblySerenity.Net.Services

Wraps an IRetrieveBehaviorSync implementation and exposes it as an IRetrieveBehaviorAsync. This allows asynchronous retrieve request handlers to run synchronous retrieve behaviors.

public class SyncToAsyncRetrieveBehaviorWrapper : IRetrieveBehaviorAsync, IWrappedBehavior

Public Members

name description
SyncToAsyncRetrieveBehaviorWrapper(…) Wraps an IRetrieveBehaviorSync implementation and exposes it as an IRetrieveBehaviorAsync. This allows asynchronous retrieve request handlers to run synchronous retrieve behaviors.
WrappedBehavior { get; }
OnAfterExecuteQueryAsync(…)
OnBeforeExecuteQueryAsync(…)
OnPrepareQueryAsync(…)
OnReturnAsync(…)
OnValidateRequestAsync(…)

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