DDD: service contains two repository

Posted by tikhop on Programmers See other posts from Programmers or by tikhop
Published on 2012-11-07T13:50:08Z Indexed on 2012/11/07 17:17 UTC
Read the original article Hit count: 159

Does it correct way to have two repository inside one service and will it be an application or domain service?

Suppose I have a Passenger object that should contains Passport (government id) object. I am getting Passenger from PassengerRepository. PassengerRepository create request to server and obtain data (json) than parse received data and store inside repository.

I have confused because I want to store Passport as Entity and put it to PassportRepository but all information about password contains inside json than i received above.

I guess that I should create a PassengerService that will be include PassengerRepository and PassportRepository with several methods like removePassport, addPassport, getAllPassenger and etc.

UPDATE:

So I guess that the better way is represent Passport as VO and store all passports inside Passenger aggregate. However there is another question: Where I should put the methods (methods calls server api) for management passenger's passport. I think the better place is so within Passenger aggregate.

© Programmers or respective owner

Related posts about design

Related posts about design-patterns