SqlCipher4Unity3D icon indicating copy to clipboard operation
SqlCipher4Unity3D copied to clipboard

OneToMany relationship

Open cstehreem opened this issue 5 years ago • 0 comments

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.

cstehreem avatar May 01 '20 07:05 cstehreem