According to Dylan's answer for the questions 'Using The Repository Pattern, Is It Best To Save Parent and Children Objects Together Or Separately?', a repository saves the entire aggregate (parent and children).
How does one go about this, would this be coded in the actually stored procedure (if using them); would you call the child repositories as well...
for instance, having a parent class Country with a list of City children:
class Country
{
List<City> cities;
...
}
and a repository snippet:
public Save(Country country)
{
...
ICityRepository cityRepository = new CityRepository();
foreach (City city in country.Cities)
{
cityRepository.Save(city);
}
...
}
or is there a better alternative?
Also, does calling the child repository as in the example above, have heavy performance implications if there are a lot of children?