using System;
using System.Threading.Tasks;
using Abp.Dependency;
namespace Abp.Events.Bus.Handlers.Internals
{
///
/// This event handler is an adapter to be able to use an action as implementation.
///
/// Event type
internal class AsyncActionEventHandler :
IAsyncEventHandler,
ITransientDependency
{
///
/// Function to handle the event.
///
public Func Action { get; private set; }
///
/// Creates a new instance of .
///
/// Action to handle the event
public AsyncActionEventHandler(Func handler)
{
Action = handler;
}
///
/// Handles the event.
///
///
public async Task HandleEventAsync(TEventData eventData)
{
await Action(eventData);
}
}
}