小编Fay*_*ayt的帖子

Sqlite一对多关系

我目前正在制作一个需要存储和从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.

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

c# generics list xamarin sqlite-net

5
推荐指数
1
解决办法
4395
查看次数

标签 统计

c# ×1

generics ×1

list ×1

sqlite-net ×1

xamarin ×1