Sqlite一对多关系

Fay*_*ayt 5 c# generics list xamarin sqlite-net

我目前正在制作一个需要存储和从sqlite数据库获取数据的应用程序.我正在使用的两个Nuget包是Sqlite PCLSQLite-Net Extensions.

[Table("patient")]
public class Patient
{
[PrimaryKey]
public string ID { get; set;}

    public string FirstName { get; set; }
    public string LastName { get; set; }

    [OneToMany]
    public List<PatientVitals> PatientVitals { get; set; }
}

[Table("patientVitals")]
public class PatientVitals
{
    [PrimaryKey]
    public string VitalID {get;set;}

    public string Weight { get; set;}
    public string Height { get; set;}

    [ForeignKey(typeof(Patient))]
    public string SmartCardID {get;set;}
}
Run Code Online (Sandbox Code Playgroud)

整个过程编译得很好,但是当我尝试运行模拟器时,我收到了这条消息:

抛出System.NotSupportedException不知道System.Collections.Generic.List1

我检查了SQLite-Net Extensions 文档,它确实支持List.

有谁知道如何解决这一问题?

Sag*_*ala 0

请将患者的主键添加为表 PatientVitals 中的外键。