2019-07-27 09:18:49 -04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace SharedLibraryCore.Interfaces
|
|
|
|
|
{
|
2019-07-29 13:08:25 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// used to handle middleware actions registered from arbitrary assemblies
|
|
|
|
|
/// </summary>
|
2019-07-27 09:18:49 -04:00
|
|
|
|
public interface IMiddlewareActionHandler
|
|
|
|
|
{
|
2019-07-29 13:08:25 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// registers an action with the middleware handler
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T">action return type</typeparam>
|
|
|
|
|
/// <param name="actionType">class type of action</param>
|
|
|
|
|
/// <param name="action">action to perform</param>
|
|
|
|
|
/// <param name="name">optional name to reference the action by</param>
|
2019-07-27 09:18:49 -04:00
|
|
|
|
void Register<T>(T actionType, IMiddlewareAction<T> action, string name = null);
|
2019-07-29 13:08:25 -04:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// executes the given action type or name
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T">action return type</typeparam>
|
|
|
|
|
/// <param name="value">instance member to perform the action on</param>
|
|
|
|
|
/// <param name="name">optional name to reference the action by</param>
|
|
|
|
|
/// <returns></returns>
|
2019-07-27 09:18:49 -04:00
|
|
|
|
Task<T> Execute<T>(T value, string name = null);
|
|
|
|
|
}
|
|
|
|
|
}
|