c# - sqlite 不识别通用列表

标签 c# sqlite windows-runtime windows-store

在 Windows 应用商店应用程序项目中,我从如下所示的 Web 服务获取 JSON:http://paste2.org/jfMJ2AGA

我有这两个类

public class media
{
    public string id { get; set; }
    public string type { get; set; }
    public string image { get; set; }
    public string video { get; set; }
    public string snapshot { get; set; }
    public string url { get; set; }
    public string snapshot_url { get; set; }
}

public class artigos
{
    public string menu { get; set; }
    public string submenu { get; set; }
    public string title { get; set; }
    public string subtitle { get; set; }
    public string description { get; set; }
    public List<media> media { get; set; }
}

我正在创建一个 sqlite 数据库:

dbPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "Database.sqlite");

//start dB
using (var db = new SQLite.SQLiteConnection(dbPath))
{
    db.CreateTable<artigos>();
}

但是我得到这个错误:

Don't know about System.Collections.Generic.List`1[xxxxx.media]

我做错了什么吗?

最佳答案

Sqllite 不支持列表。这意味着你不能拥有

public List<media> media { get; set; } 

关于c# - sqlite 不识别通用列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21833749/

相关文章:

c# - 在 WinRT 中,静态字段根本没有初始化

c# - 如何在 Windows Phone Runtime 中访问专辑、艺术家、播放列表?

c# - 从生成的表中检索数据时对象名称 'dbo.TableName' 无效

java - Java 应用程序的数据库

sqlite - 如何删除sqlite表的所有索引

c# - 保存的文件有时只包含 NUL 字符

c# - 是否可以在 C# 中合并字符串和 DBNull?

c# - 为什么我不能在 For 循环中使用 ==?

C# object array = null,不释放内存

ruby-on-rails - rake 数据库 :test:prepare does not setup test database