Command、CommandHandler 和 CommandInvoker

Command, CommandHandler and CommandInvoker(Command、CommandHandler 和 CommandInvoker)
本文介绍了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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)