jeudi 4 février 2016

fully delete a relationship in a many to many table in sqlite-net extension?

I have a similar situation, to this post the delete works but only on students and classes table, in the student_classes table the elements are not deleted.

  public class Students
{
    [PrimaryKey, AutoIncrement]
    public int StudentId { get; set; }
    public string Name { get; set; }

    [ManyToMany(typeof(Students_Classes))]
    public List<Classes> Classes { get; set; }
}

public class Classes
{
    [PrimaryKey, AutoIncrement]
    public int ClassId { get; set; }
    public string Name { get; set; }

    [ManyToMany(typeof(Students_Classes))]
    public List<Students> Students { get; set; }
}

public class Students_Classes
{
    [ForeignKey(typeof(Students))]
    public int StudentFId { get; set; }

    [ForeignKey(typeof(Classes))]
    public int ClassFId { get; set; }
}

I have no problem during insert and updates thanks

p.s. My classes have different names, but doesn't matter, the code is really identical

Aucun commentaire:

Enregistrer un commentaire