我正在尝试在(当前)Android Samsung S6 手机上的数据库中使用多对多数据库关系。为此,我使用 SQLite.Net-PCL 3.0.5 和 SQLiteNetExtensions 1.3.0。我有简单的 SQlite 访问工作正常,但现在我尝试设置多对多关系(通过链接表),当我调用时,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 包吗?