繁体   English   中英

找不到方法'SQLiteConnection.InsertAll'

[英]Method 'SQLiteConnection.InsertAll' not found

我正在尝试在(当前)Android Samsung S6手机上的数据库中使用多对多数据库关系。 为此,我正在使用SQLite.Net-PCL 3.0.5和SQLiteNetExtensions 1.3.0。 我有简单的SQlite访问可以正常工作,但是现在我尝试建立多对多关系(通过链接表),当我调用m_DatabaseConnection.UpdateWithChildren(article);时,将抛出sqlite-net-extensions m_DatabaseConnection.UpdateWithChildren(article);

例外是:

 System.MissingMethodException: Method 'SQLiteConnection.InsertAll' not found. 

这很奇怪,因为我反汇编了dll并确定它确实存在。 我的数据类的结构是:

public class Article : BaseModel
{
    public Article()
    {
        Audience = new List<Tag>();
        Content = new List<Tag>();
        Weather = new List<Tag>();
    }

    ...   

    [ManyToMany(typeof(ArticleTag))]
    public List<Tag> Audience { get; set; }
    [ManyToMany(typeof(ArticleTag))]
    public List<Tag> Content { get; set; }
    [ManyToMany(typeof(ArticleTag))]
    public List<Tag> Weather { get; set; }

   ....
}

    public class ArticleTag
{
    [ForeignKey(typeof(Article))]
    public int ArticleID { get; set; }
    [ForeignKey(typeof(Tag))]
    public int TagID { get; set; }
}

public class Tag : BaseModel
{
    ...
}

public class BaseModel
{
    public BaseModel()
    {

    }

    [PrimaryKey, AutoIncrement]
    public int ID { get; set; }

    public bool Dirty { get; set; }
}

那我在做什么错? 我是否需要包含其他版本的SQLite.Net-PCL? 我尝试下载并编译扩展项目,但是似乎出现了错误(由于我没有iOS许可证,所以我不得不卸载iOS项目,但其余的应该已经编译了)。

有任何想法吗?

-更新-

似乎该行必须在“ WriteOperations.cs”中:

private static void UpdateManyToManyForeignKeys(this SQLiteConnection conn, object element, PropertyInfo relationshipProperty)
    {
...

    conn.InsertAll(missingIntermediateObjects);

    ..
    }

然后转到SQLiteExtensions-MvvmCross,并且必须找不到接口的实现。 所以,问题是,我是否需要其他NuGet软件包?

因此,看起来这是对误解的意图和1.3的破坏的结合。

我回滚到1.2.5,它停止引发异常。 但实际上并没有保存。 然后,我查看了项目源代码中包含的测试用例(可在此处找到: https : //bitbucket.org/twincoders/sqlite-net-extensions ),发现他并没有直接节省很多费用。许多关系。 相反,他插入了初始实体,然后在相同实体上调用UpdateWithChildren来填写链接表。 这似乎有效。 我不清楚为什么不将其汇总为一个呼叫,但是它允许我继续前进。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM