Do DDD and SOA really play well together?

前端 未结 4 1146
野性不改
野性不改 2021-01-31 00:20

Please let me know, ever so gently, if I am totally mangling the DDD concept, but here is my dilemma.

Let\'s say I have the following domain model:

Teach         


        
4条回答
  •  一向
    一向 (楼主)
    2021-01-31 00:52

    What Vijay is saying is to add a TeacherService with an AddStudent method

    interface ITeacherService
    {
      Teacher GetTeacher (name teacher);
      void AddStudent (Teacher teacher, Student student);
    }
    

    So then you would end up with something like the following:

    Student student = new Student ("Bobby Drop Tables;");
    Teacher teacher = teacherService.GetTeacher ("Bob");
    teacherService.AddStudent (teacher, student);
    

提交回复
热议问题