PageRenderTime 17ms CodeModel.GetById 10ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Source/Bifrost/Events/IProcessMethodInvoker.cs

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