私は次のものを持っています:
class City {
    int id;
    string Name;
    ICollection<Person> Persons;
}
class Person {
   int id;
   string Name;
}
都市と関連するすべての人を削除する正しい方法はどれですか? おそらく、外部キー制約を避けて手動で行いたいと思います。私はもう試した:
public bool Delete(int id // City Id)
{
    City city = _db.Cities
                .Include(c => c.Persons)
                .First(c => c.Id == id);
    if(city != null)
    {
        foreach (Person person in city.Persons)
        {
            _db.Persons.Remove(person);
        }
        _db.Cities.Remove(city);
        _db.SaveChanges();
        return true;
    }
    return false;
}
しかし、データベースから削除されている人や都市はありません。