Skip to content

SyncToAsyncSaveBehaviorWrapper class

namespace: Serenity.Services   assemblySerenity.Net.Services

Wraps an ISaveBehaviorSync implementation and exposes it as an ISaveBehaviorAsync. This allows asynchronous save request handlers to run synchronous save behaviors.

public class SyncToAsyncSaveBehaviorWrapper : ISaveBehaviorAsync, IWrappedBehavior
parameter description
syncBehavior Synchronous save behavior to wrap

Public Members

name description
SyncToAsyncSaveBehaviorWrapper(…) Wraps an ISaveBehaviorSync implementation and exposes it as an ISaveBehaviorAsync. This allows asynchronous save request handlers to run synchronous save behaviors.
WrappedBehavior { get; }
OnAfterSaveAsync(…)
OnAuditAsync(…)
OnBeforeSaveAsync(…)
OnPrepareQueryAsync(…)
OnReturnAsync(…)
OnSetInternalFieldsAsync(…)
OnValidateRequestAsync(…)

Exceptions

exception condition
ArgumentNullException syncBehavior is null.

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.

Initializes a new instance of the class.

See Also