当使用CQRS设计模式? [英] When to use the CQRS design pattern?

查看:278
本文介绍了当使用CQRS设计模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和我的团队一直在使用CQRS(命令查询责任分离)设计模式讨论,我们仍在努力以评估使用它的利弊。据: http://martinfowler.com/bliki/CQRS.html

My team and I have been discussing using the CQRS (Command Query Responsibility Segregation) design pattern and we are still trying to asses the pros and cons of using it. According to: http://martinfowler.com/bliki/CQRS.html

,我们还没有在现场看到CQRS的足够的用途尚未有信心
  我们了解它的利弊

we haven't seen enough uses of CQRS in the field yet to be confident that we understand its pros and cons

所以,你们觉得什么,什么时候做的一个问题要求使用CQRS?

So what do you guys think, when does a problem call for using CQRS?

推荐答案

CQRS是不是涵盖整个应用程序的模式。

CQRS is not a pattern that encompasses the whole application.

这是建立在领域驱动设计(DDD)的概念。和DDD的一个重要的战略概念是所谓的界上下文

It is a concept that builds on Domain Driven Design (DDD). And an important strategic concept of DDD is the so-called Bounded Context.

在一个典型的应用中存在多个有界的上下文,其中任何一个可以被实现是有意义的方式。例如

In a typical application there are multiple bounded contexts, any of which can be implemented the way it makes sense. For instance


  • 用户管理 - > CRUD

  • 发票 - > CRUD

  • 保险策略管理(核心域) - > CQRS

  • ...

这可能不回答你的问题,但它可能给多一点洞察话题。说实话,我不认为它可以在所有的回答,而不考虑项目的具体情况,而且当时很少有像一个明确的最佳实践

This probably doesn't answer your question but it might give a little more insight into the topic. To be honest, I don't think it can be answered at all without considering a project's specifics, and even then there is rarely something like a definite best practice.

这篇关于当使用CQRS设计模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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