netpyoung / SqlCipher4Unity3D

💾 SqlCipher made easy for Unity3d
MIT License
163 stars 37 forks source link

OneToMany relationship #27

Open cstehreem opened 4 years ago

cstehreem commented 4 years ago

Is it possible to map relationships to classes? Here are my Models:

public class Word
{
    [PrimaryKey] [AutoIncrement] public int id { get; set; }
    public string normal_form { get; set; }
    public IList<Word_Orth> variants { get; set; }
}
public class Word_Orth
{
    [PrimaryKey] [AutoIncrement] public int id { get; set; }
    public int word_id { get; set; }
    public string orthogonal_form { get; set; }
}

One word can have many orthogonal forms. I want to be able to fetch words together with their orthogonal forms in a list. Is this possible?

My current query is SELECT * from Word inner join Word_Orth on Word_Orth.word_id == Word.id but it fetches multiple instances of Word and null in variants.