質問のディランの回答'Using The Repository Pattern, Is It Best To Save Parent and Children Objects Together Or Separately?'によれば、リポジトリは集約全体(親と子)を保存します。集計(親と子)をリポジトリに保存する方法
実際にストアドプロシージャ(使用している場合)にコード化されていますか?
class Country
{
List<City> cities;
...
}
とリポジトリスニペット:
public Save(Country country)
{
...
ICityRepository cityRepository = new CityRepository();
foreach (City city in country.Cities)
{
cityRepository.Save(city);
}
...
}
か、市の子どもたちのリストを親クラスの国を持つ、子リポジトリにも...例えば
を呼ぶだろう良い選択肢がありますか?
また、上記の例のように子リポジトリを呼び出すと、多くの子がある場合、パフォーマンスに大きな影響がありますか?