fixed service registration for event handlers and executors.

This commit is contained in:
kay.one 2013-05-07 22:47:15 -07:00
parent 399c96c5e3
commit fa8f67d7fe
12 changed files with 190 additions and 95 deletions

View file

@ -23,13 +23,13 @@ namespace NzbDrone.Api.Commands
{
var commandType = _commands.Single(c => c.GetType().Name.Replace("Command", "").Equals(resource.Command, StringComparison.InvariantCultureIgnoreCase))
.GetType();
var command = (object)Request.Body.FromJson<ICommand>(commandType);
var method = typeof(IMessageAggregator).GetMethod("PublishCommand");
var genericMethod = method.MakeGenericMethod(commandType);
genericMethod.Invoke(_messageAggregator, new[] { command });
var command = Request.Body.FromJson<ICommand>(commandType);
_messageAggregator.PublishCommand(command);
return resource;
}
}
}