Search code examples
c#asp.net-mvc-3cqrssharp-architecture

Error with Sharp Architecture Tasks Layer: Command handler not found for command type


I am currently using Sharp Architecture 2.0 and have been doing pretty well with it. But I am coming on an issue with Performing commands in the Tasks layer. I have the following classes associated with my Command:

SaveOptionStep1Command which implements CommandBase and SaveOptionStep1CommandHandler which implements
ICommandHandler< SaveOptionStep1Command > and
SaveOptionStep1CommandResult which implements CommandResult

When I create the command, I get the below error and cannot determine where the issue is coming from.

ERROR
Command handler not found for command type: EasyOptions.Tasks.Commands.SaveOptionStep1Command

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: SharpArch.Domain.Commands.CommandHandlerNotFoundException: Command handler not found for command type: EasyOptions.Tasks.Commands.SaveOptionStep1Command

Here is a Githubu Gist of my code: https://gist.github.com/1314136


Solution

  • I found out that I was creating the Repositories incorrectly. I was creating my repositories with my ClientRepository class instead of accessing it using the interface IRepositoryWithTypedId. Once I changed that my Repositories and Handlers were correctly added to my Windsor Container without any dependency issues. It is now working as I need it to.