如何在Sqlite Xamarin表单中连接两个表值?

我在C#的Xamarin中创建了两个模型Outlet_model和TbTrdDocModel。 我可以分别访问每个模型的值,但现在我想在SQLite中加入两个表。 有人知道如何加入这两个模型来访问listview中的数据吗? 提前致谢。

试试这个

public class MusicItems { [PrimaryKey, AutoIncrement] public int Id { get; set; } public String Name { get; set; } public String Tension { get; set; } public String Category { get; set; } public String Subcategory { get; set; } public int ResId { get; set; } public int LoopStart { get; set; } } public class Playlist { public String Name { get; set; } public int ResId { get; set; } public int LoopStart { get; set; } } public class Themes { [PrimaryKey, AutoIncrement] public int Id { get; set; } public String ThemeName { get; set; } public String ThemeDesc { get; set; } public int ThemeImg { get; set; } public String ThemeCategory { get; set; } public String ThemeSubcategory { get; set; } } public class MusicInThemes { [PrimaryKey, AutoIncrement] public int Id { get; set; } public int ResId { get; set; } public int ThemeId { get; set; } } 

查询:

 return database.Table() .Join(database.Table().Where(t => t.ThemeId == ThemeID) ,m =>m.ResId ,t => t.ResId ,(m,t) => new {mym = m, myt = t }) .Select(a => new Playlist { Name = a.mym.Name, ResId = a.mym.ResId, LoopStart = 0 }) .ToList();