PageRenderTime 38ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/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
  1. using System;
  2. namespace Bifrost.Events
  3. {
  4. /// <summary>
  5. /// Defines an invoker for handle methods - it should recognize methods called Handle and be able to
  6. /// call them
  7. /// </summary>
  8. /// <remarks>
  9. /// This is a convention were a type implementing methods called Handle taking specific commands in.
  10. /// </remarks>
  11. public interface IProcessMethodInvoker
  12. {
  13. /// <summary>
  14. /// Try to call handle method for a specific command
  15. /// </summary>
  16. /// <param name="instance">Instance to try to call Handle method on</param>
  17. /// <param name="event">The <see cref="IEvent"/> that the Process method should take</param>
  18. /// <returns>True if it called the Handle method, false if not</returns>
  19. bool TryProcess(object instance, IEvent @event);
  20. /// <summary>
  21. /// Register a type that should have Handle method(s) in it
  22. /// </summary>
  23. /// <param name="typeWithProcessMethods">Type to register</param>
  24. void Register(Type typeWithProcessMethods);
  25. }
  26. }