How To Delete A Relationship From Many To Many Table In Sqlite-net Extension?
I've a many to many relationship between students and classes using SQLite-net Extensions: public class Students { [PrimaryKey, AutoIncrement] public int StudentId { get; s
Solution 1:
Pretty easy, just add a primary key to your relationship class:
publicclassStudents_Classes
{
[PrimaryKey, AutoIncrement]
publicint Id { get; set; }
[ForeignKey(typeof(Students))]
publicint StudentFId { get; set; }
[ForeignKey(typeof(Classes))]
publicint ClassFId { get; set; }
}
Anyway using SQLite-Net Extensions you don't need to manage the relationship table by yourself, just add or remove the children item from the list and call UpdateWithChildren on the object.
Take a look at the Integration Tests project to see how it works.
Post a Comment for "How To Delete A Relationship From Many To Many Table In Sqlite-net Extension?"