Class EventDispatcherAction<TSignal>
Base class for event dispatcher actions associated with specific signal types.
Inherited Members
Namespace: Serenity.EventDispatcher.Domain.Entities
Assembly: Serenity.Global.Application.dll
Syntax
public abstract class EventDispatcherAction<TSignal> : IEventDispatcherAction, IDisposable where TSignal : EventDispatcherSignal
Type Parameters
| Name | Description |
|---|---|
| TSignal | The type of signal this action responds to. |
Remarks
Inherit from this class to create custom event dispatcher actions for specific signal types.
Constructors
EventDispatcherAction()
Declaration
protected EventDispatcherAction()
Properties
LogCategory
Gets the category this action writes to the log service under.
Declaration
protected virtual string LogCategory { get; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
Defaults to the concrete action's type name. Override only when a call site's historical log category does not match that type name (e.g. a class named with an "Action" suffix that logged under the shorter, suffix-less name before this property existed).
SignalType
Gets the type of signal this action is associated with.
Declaration
public Type SignalType { get; }
Property Value
| Type | Description |
|---|---|
| Type |
Methods
Dispose()
Declaration
public void Dispose()
Execute(TSignal)
Declaration
protected abstract void Execute(TSignal signal)
Parameters
| Type | Name | Description |
|---|---|---|
| TSignal | signal |
Initialize(IEventDispatcherService)
Initializes the action with the given event dispatcher service.
Declaration
public void Initialize(IEventDispatcherService dispatcher)
Parameters
| Type | Name | Description |
|---|---|---|
| IEventDispatcherService | dispatcher | The event dispatcher service to use. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown if |
LogError(string)
Writes an error log message under LogCategory; no-ops without a log service.
Declaration
protected void LogError(string message)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The message to log. |
LogInfo(string)
Writes an information log message under LogCategory; no-ops without a log service.
Declaration
protected void LogInfo(string message)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The message to log. |
LogWarning(string)
Writes a warning log message under LogCategory; no-ops without a log service.
Declaration
protected void LogWarning(string message)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The message to log. |
OnDisposed()
Declaration
protected virtual void OnDisposed()
OnInitialized()
Declaration
protected virtual void OnInitialized()
TryResolveService<TService>(out TService)
Attempts to resolve a service through ServiceLocatorBridge, the composition-edge escape hatch used because EventDispatcher actions are instantiated via reflection and cannot receive constructor injection.
Declaration
protected bool TryResolveService<TService>(out TService service) where TService : class
Parameters
| Type | Name | Description |
|---|---|---|
| TService | service | The service instance if resolved; |
Returns
| Type | Description |
|---|---|
| bool |
|
Type Parameters
| Name | Description |
|---|---|
| TService | The type of the service to resolve. |