/Source/Bifrost/Events/IProcessMethodInvoker.cs
C# | 28 lines | 9 code | 2 blank | 17 comment | 0 complexity | 7679e6a32c9bb2fc3942801745e61cfc MD5 | raw file
Possible License(s): CC-BY-SA-3.0
- using System;
-
- namespace Bifrost.Events
- {
- /// <summary>
- /// Defines an invoker for handle methods - it should recognize methods called Handle and be able to
- /// call them
- /// </summary>
- /// <remarks>
- /// This is a convention were a type implementing methods called Handle taking specific commands in.
- /// </remarks>
- public interface IProcessMethodInvoker
- {
- /// <summary>
- /// Try to call handle method for a specific command
- /// </summary>
- /// <param name="instance">Instance to try to call Handle method on</param>
- /// <param name="event">The <see cref="IEvent"/> that the Process method should take</param>
- /// <returns>True if it called the Handle method, false if not</returns>
- bool TryProcess(object instance, IEvent @event);
-
- /// <summary>
- /// Register a type that should have Handle method(s) in it
- /// </summary>
- /// <param name="typeWithProcessMethods">Type to register</param>
- void Register(Type typeWithProcessMethods);
- }
- }