领域驱动设计:域名服务,应用服务 [英] Domain Driven Design: Domain Service, Application Service

查看:215
本文介绍了领域驱动设计:域名服务,应用服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能提供一些例子说明域和应用服务之间的区别?而且,如果服务是一个域的服务,将我把实际执行此服务的领域组件内,如果是的话,我也注入到仓库域服务?有些信息将是真正有用的。

Can someone explain the difference between domain and application services by providing some examples? And, if a service is a domain service, would I put the actual implementation of this service within the domain assembly and if so, would I also inject repositories into that domain service? Some info would be really helpful.

推荐答案

服务有3种形式:域名服务 应用服务基础设施服务

Services come in 3 flavours: Domain Services, Application Services, and Infrastructure Services


  • 域服务:封装
    那不自然的业务逻辑
    适合域对象之内,并且是不会典型的CRUD操作 - 这些都属于一个的

  • 应用服务:由使用
    外部消费者谈谈您
    系统(认为的 Web服务的)。如果消费者需要访问CRUD操作,他们将在这里暴露无遗。

  • 基础设施服务:用于
    抽象的技术问题(如
    MSMQ,电子邮件服务提供商等)

  • Domain Services : Encapsulates business logic that doesn't naturally fit within a domain object, and are NOT typical CRUD operations - those would belong to a Repository.
  • Application Services : Used by external consumers to talk to your system (think Web Services). If consumers need access to CRUD operations, they would be exposed here.
  • Infrastructure Services : Used to abstract technical concerns (e.g. MSMQ, email provider, etc)

保持域服务域对象一起是明智 - 它们都集中在域逻辑。是的,你可以注入到存储库的服务。

Keeping Domain Services along with your Domain Objects is sensible - they are all focused on domain logic. And yes, you can inject Repositories into your Services.

应用服务通常会同时使用域服务的的库来处理外部的请求。

Application Services will typically use both Domain Services and Repositories to deal with external requests.

希望帮助!

这篇关于领域驱动设计:域名服务,应用服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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