I'm trying to get many-to-many database relationships working in my database on (currently) an Android Samsung S6 mobile. To this end I am using SQLite.Net-PCL 3.0.5 and SQLiteNetExtensions 1.3.0.
I have had simple SQlite access working fine, but now I have attempted to setup a many to many relationship (via a linking table), the sqlite-net-extensions are throwing when I call
m_DatabaseConnection.UpdateWithChildren(article);
The exception is:
System.MissingMethodException: Method 'SQLiteConnection.InsertAll' not found.
Which is weird, as I disassembled the dll and established that it definitely does exist. The structure of my data classes are:
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; }
}
So what am I doing wrong? Do I need to include a different version of SQLite.Net-PCL? I tried downloading and compiling the extension project, but there seemed to be errors (I had to unload the iOS projects, as I don't have a licence for iOS, but the rest should have compiled).
Any ideas?
-- Update ---
It seems that the line in question must be within "WriteOperations.cs":
private static void UpdateManyToManyForeignKeys(this SQLiteConnection conn, object element, PropertyInfo relationshipProperty)
{
...
conn.InsertAll(missingIntermediateObjects);
..
}
This then goes off to SQLiteExtensions-MvvmCross and must fail to find the implementation of the interface. So, question is, do I need other NuGet packages?