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

查看:64
本文介绍了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层中运行.应用程序服务从数据库获取数据,验证数据,将数据传递给客户端(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天全站免登陆