Sharp 架构任务层错误:未找到命令类型的命令处理程序
我目前正在使用 Sharp Architecture 2.0,并且使用效果非常好。但我遇到了在任务层中执行命令的问题。我有以下与我的命令关联的类:
SaveOptionStep1Command,它实现了CommandBase和 SaveOptionStep1CommandHandler 实现
ICommandHandler< SaveOptionStep1Command > 和
SaveOptionStep1CommandResult 实现 CommandResult
当我创建命令时,出现以下错误,并且无法确定问题出在哪里来自。
错误
未找到命令类型的命令处理程序: EasyOptions.Tasks.Commands.SaveOptionStep1Command
描述: 执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其在代码中的来源的更多信息。
异常详细信息: SharpArch.Domain.Commands.CommandHandlerNotFoundException:未找到命令类型的命令处理程序:EasyOptions.Tasks.Commands.SaveOptionStep1Command
这是我的代码的 Githubu 要点:https://gist.github.com/1314136
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现我错误地创建了存储库。我使用 ClientRepository 类创建存储库,而不是使用接口 IRepositoryWithTypedId 访问它。一旦我更改了我的存储库和处理程序就已正确添加到我的 Windsor 容器中,而没有任何依赖性问题。它现在正在按照我的需要工作。
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.
我在使用 SharpArch 2.0.4 时也遇到了同样的问题。
在花了几个小时使用 ComponentsRegistars.cs 进行 Castle 组件注册后,我发现我需要修改 AddTasksTo 方法。
我的观点是,由于命令主要放置在基础设施中,
因此它们用 : 替换了旧版本:
我认为,最终将选择每个元素。
所以,通过使用第一个版本,问题就解决了。
谢谢
I had the same issue with SharpArch 2.0.4.
After spending a couple of hours playing with the ComponentsRegistars.cs for Castle components registration, I figure out the that I need to modify the AddTasksTo method.
My viewpoint is that since Commands are mainly placed in Infrastructure, they replace the old version of:
with this :
which eventually will pick each and every element, I think.
So, by using the first version, the problem solved.
Thanks