SQLite的扩展未按预期 [英] Sqlite extension is not working as expected

查看:212
本文介绍了SQLite的扩展未按预期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的WinRT的应用程序。我想用 sqlite的净扩展来支持一对多多对多

I am working on an WinRT app. I want to use sqlite-net-extensions to support OneToMany, ManyToMany.

using SQLiteNetExtensions.Attributes;
using SQLite;

[Table("WorkFlow")]
public class Workflow
{
    [PrimaryKey, AutoIncrement]
    public int WorkflowId { get; set; }
    public string Name { get; set; }
    public int Revision { get; set; }
    [OneToMany]
    public List<Step> Steps { get; set; }
}

[Table("Step")]
public class Step
{
    public string Type { get; set; }
    public string Description { get; set; }
    [ManyToOne]
    public Workflow Workflow { get; set; }
}

当我尝试生成数据库中的表,它引发异常

When I try to generate the tables for the database, it raises the exception:

System.NotSupportedException类型的异常出现在
app_name.exe但在用户代码的其他信息没有处理:
不知道System.Collections.Generic.List`1 [app_name.Model.modelName]

An exception of type 'System.NotSupportedException' occurred in app_name.exe but was not handled in user code Additional information: Don't know about System.Collections.Generic.List`1 [app_name.Model.modelName]

这从 SQLTYPE 进来 SQLite.cs

但是从上 sqlite的净扩展 首页列表属性应该正常工作

But from the example on the sqlite-net-extensions homepage, List property should work fine.

这是他们的榜样的副本:

This is a copy of their example:

public class Stock
{
    [PrimaryKey, AutoIncrement]
    public int Id { get; set; }
    [MaxLength(8)]
    public string Symbol { get; set; }

    [OneToMany]      // One to many relationship with Valuation
    public List<Valuation> Valuations { get; set; }
}

public class Valuation
{
    [PrimaryKey, AutoIncrement]
    public int Id { get; set; }

    [ForeignKey(typeof(Stock))]     // Specify the foreign key
    public int StockId { get; set; }
    public DateTime Time { get; set; }
    public decimal Price { get; set; }

    [ManyToOne]      // Many to one relationship with Stock
    public Stock Stock { get; set; }
}



谁能给我一些建议来解决这个问题?谢谢你。

Can anyone give me some suggestions to solve this problem? Thanks.

推荐答案

这通常是安装问题造成的,因为SQLite的-Net的扩展使用一个SQLite-Net的库编译的,但你使用其他运行你的App。您可以尝试添加 PCL的NuGet 包到您的项目,或者你也可以下载的从Git的来源及直接引用该项目。

This is usually an installation issue caused because SQLite-Net Extensions was compiled using a SQLite-Net library but you are running your App using another. You can try adding the PCL NuGet package to your project or you can download the sources from Git and reference the project directly.

这篇关于SQLite的扩展未按预期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆