MVC 中的 Controller 是否被视为 DDD 的应用程序服务? [英] Is the Controller in MVC considered an application service for DDD?

查看:13
本文介绍了MVC 中的 Controller 是否被视为 DDD 的应用程序服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的 MVC 的 M 部分应用 DDD,经过一些研究(学习!),我意识到我需要我的控制器与域服务交互(在模型中).这将使我的控制器成为域服务的使用者,因此成为应用程序服务(在 DDD 术语中).这是准确的吗?控制器和 DD 定义为应用服务的东西有区别吗?

I am applying DDD for the M part of my MVC and after some research (studying up!), I have come to the realization that I need my controller to be interacting with domain services (in the model). This would make my controller the consumer of the domain services and therefore an application service (in DDD terms). Is this accurate? Is there a difference between a controller and what DD defines as an application service?

推荐答案

控制器在 DDD 中不被视为服务.控制器在 UI 层运行.应用程序服务从 DB 获取数据,验证数据,将数据传递给客户端(MVC 可以是客户端,但来自 winforms 应用程序的请求也可以)等等.

The controller is not considered a service in DDD. The controllers operate in the UI tier. The application services gets data from the DB, validates data, passes data to client (MVC could be a client but so could a request coming from a winforms app) etc etc.

控制器所做的就是为来自 UI 的请求提供服务.它不是应用程序域的一部分.

All the controller is doing is servicing requests from the UI. Its not part of the application domain.

这篇关于MVC 中的 Controller 是否被视为 DDD 的应用程序服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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