AsyncToSyncSaveBehaviorWrapper class
namespace: Serenity.Services assembly: Serenity.Net.Services
Wraps an ISaveBehaviorAsync implementation and exposes it as an ISaveBehaviorSync by blocking on its async methods. This allows synchronous save request handlers to run asynchronous save behaviors.
public class AsyncToSyncSaveBehaviorWrapper : ISaveBehaviorSync, IWrappedBehavior
| parameter | description |
|---|---|
| asyncBehavior | Asynchronous save behavior to wrap |
Public Members
| name | description |
|---|---|
| AsyncToSyncSaveBehaviorWrapper(…) | Wraps an ISaveBehaviorAsync implementation and exposes it as an ISaveBehaviorSync by blocking on its async methods. This allows synchronous save request handlers to run asynchronous save behaviors. |
| WrappedBehavior { get; } | |
| OnAfterSave(…) | |
| OnAudit(…) | |
| OnBeforeSave(…) | |
| OnPrepareQuery(…) | |
| OnReturn(…) | |
| OnSetInternalFields(…) | |
| OnValidateRequest(…) |
Exceptions
| exception | condition |
|---|---|
| ArgumentNullException | asyncBehavior 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
- interface ISaveBehaviorSync
- interface IWrappedBehavior
- Source: AsyncToSyncSaveBehaviorWrapper.cs