Skip to content

CompanionHandlerTypeAttribute class

namespace: Serenity.Services   assemblySerenity.Net.Services

Specifies the companion (other mode) handler interface for a request processor interface, e.g. ISaveRequestProcessorAsync as companion of ISaveRequestProcessor, together with a wrapper type that adapts a custom handler of the companion interface to this interface.

[AttributeUsage(AttributeTargets.Interface)]
public class CompanionHandlerTypeAttribute : Attribute

Public Members

name description
CompanionHandlerTypeAttribute(…) Specifies the companion (other mode) handler interface for a request processor interface, e.g. ISaveRequestProcessorAsync as companion of ISaveRequestProcessor, together with a wrapper type that adapts a custom handler of the companion interface to this interface.
CompanionType { get; } Gets the companion (other mode) handler interface type.
WrapperType { get; } Gets the open generic wrapper type that adapts a handler implementing CompanionType to the interface this attribute is applied to.

Remarks

This attribute is used by DefaultHandlerFactory to discover custom request handlers of the other (sync / async) mode, when no custom handler exists for the requested mode. For example when an async behavior requests ISaveRequestProcessor for a row, but only an async custom handler implementing ISaveRequestProcessorAsync is available, the factory returns the async custom handler wrapped in the specified wrapper type so that custom handler logic is not silently skipped.

See Also