Ncqrs.Eventing.Sourcing.Mapping.AttributeBasedDomainSourcedEventHandlerMappingStrategy.CreateHandlerForMethod C# (CSharp) Method

CreateHandlerForMethod() private static method

private static CreateHandlerForMethod ( IEventSource eventSource, MethodInfo method, Ncqrs.Eventing.Sourcing.Mapping.EventHandlerAttribute attribute ) : ISourcedEventHandler
eventSource IEventSource
method System.Reflection.MethodInfo
attribute Ncqrs.Eventing.Sourcing.Mapping.EventHandlerAttribute
return ISourcedEventHandler
        private static ISourcedEventHandler CreateHandlerForMethod(IEventSource eventSource, MethodInfo method, EventHandlerAttribute attribute)
        {
            Type firstParameterType = method.GetParameters().First().ParameterType;

            Action<IEvent> handler = e => method.Invoke(eventSource, new object[] { e });

            return new TypeThresholdedActionBasedDomainEventHandler(handler, firstParameterType, attribute.Exact);
        }