Command、CommandHandler 和 CommandInvoker [英] Command, CommandHandler and CommandInvoker

查看:38
本文介绍了Command、CommandHandler 和 CommandInvoker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在一个开源 ASP.NET MVC 3 项目中看到了一个新模式(对我来说是新模式),它有许多 CommandCommandHandlerCommandInvoker - 以及它们的接口 - 我无法理解这种模式!你能告诉我这种模式的名称是什么,我在哪里可以了解它?请问它有什么好处?提前致谢.

I recently saw a new pattern (new to me) in an open source ASP.NET MVC 3 project that hase many Command, CommandHandler, and CommandInvoker -with their interfaces- and I can't understand the pattern! Can you tell me what is this pattern's name and where can I learn about it? And what is its benefits please? Thanks in advance.

更新:我说的是这个项目:

使用 RavenDB 的图片库

推荐答案

看看这篇文章:同时......在我的架构的命令端

它包含有关为什么要将命令和命令处理程序用作架构的一部分的详尽说明.像 CQRS 这样的架构模式是基于命令和事件的,但即使不应用 CQRS,在架构中使用命令也是非常有价值的,正如文章所解释的那样.

It contains a thorough explanation about why you want to use commands and command handlers as part of your architecture. An architectural pattern such as CQRS is based on commands and events, but even without applying CQRS, the use of commands in your architecture is very valuable, as the article explains.

然而,RavenGallery 项目太小,无法真正看到这种命令/处理程序模型的好处.当项目变大时,这种模式开始大放异彩.

The RavenGallery project, however, is too small to really see the benefits of this command/handler model. This model starts to shine when a project gets bigger.

我的书的第 10 章可以找到有关此主题的更深入讨论.

A more thorough discussion on this topic can be found in chapter 10 of my book.

这篇关于Command、CommandHandler 和 CommandInvoker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆