代码之家  ›  专栏  ›  技术社区  ›  Piotr

这是DDD应用程序还是域服务?

  •  3
  • Piotr  · 技术社区  · 13 年前

    我对整个领域驱动的设计有点陌生,如果你能告诉我你认为像这样的服务方法在应用程序或领域层属于哪里,我会喜欢它的:

    List<Children> getChildrenByParent(Parent parent, int offset, int count) {
    
       return repository.listChildrenByParent(Parent parent, int offset, int count);
    }
    

    我还想知道,当模型中存在大量的实体集合和/或当我需要有效地过滤事物时,这是否是一种可以接受的处理方法。

    谢谢

    2 回复  |  直到 13 年前
        1
  •  5
  •   quentin-starin    13 年前

    你列出的方法似乎没有任何意义。为什么要使方法getchildrenbyparent 确切地 包装存储库.listchildrenbyparent?它已经在正确的位置-在存储库中。只要在需要的地方使用repository.listchildrenbyparent。

        2
  •  2
  •   Aravind Yarram    13 年前

    其中一个思想过程是将核心功能域与查询域(报告、搜索等)分开。您添加的方法似乎用于报告或搜索目的。您应该直接调用存储库中的方法