I am using sqlite net extensions library in my xamarin.forms application. I code in my PCL the database code and models.
When I call SQLiteConnection.CreateTable() I get
The problem was that I had installed two different libraries for sqlite, both containing a SQLiteConnection
.
I needed to use the Sqlite.Net.SQLiteConnection
class for sqlite net extensions. Not the Sqlite.SQLiteConnection
I was using.
As SushiHangover pointed out, this Sqlite.Net.SQLiteConnection
takes a first argument of type ISQLitePlatform
.
To obtain a reference for this, I defined an interface that provides the signature of a method to return a ISQLitePlatform
:
public interface ISQLitePlatformInstance
{
ISQLitePlatform GetSQLitePlatformInstance();
}
And I implemented the interface in my Droid project ( the platform I'm building against):
public class SQLitePlatformInstance : ISQLitePlatformInstance
{
public ISQLitePlatform GetSQLitePlatformInstance()
{
return new SQLitePlatformAndroid();
}
}