- edited description
'SQLiteConnection' does not contain a definition for 'InsertWithChildren' with .Net Standard 2.0
Issue #138
new
I have tried creating a fresh .Net Standard 2.0 project and only getting the Nuget package SQLiteNetExtensions 2.1.0 as well as trying SQLiteNetExtensions.Async 2.1.0 and for both, I am unable to call any of the extension methods from the class SQLiteConnection such as InsertWithChildren or InsertWithChildrenAsync when using SQLiteAsyncConnection.
I am able to use the annotations from the class SQLiteNetExtensions.Attributes such as ForeignKey and OneToMany, so the SQLiteNetExtensions package is installed, but doesn't seem to be overriding the SQLiteConnection class correctly.
using SQLite;
using System;
using System.IO;
using Test.Models;
namespace Test.Services
{
class Database
{
private static SQLiteConnection _db;
public static SQLiteConnection db
{
get
{
if(_db == null){
string dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "test.sqlite");
_db = new SQLiteConnection(dbPath);
_db.CreateTable<Customer>();
_db.CreateTable<Package>();
_db.CreateTable<Stop>();
_db.CreateTable<PickupStop>();
}
return _db;
}
}
public static void CreatePickupStop(PickupStop pickupStop)
{
int id = Database.db.InsertWithChildren(pickupStop);
}
}
}
Comments (5)
-
reporter -
reporter - edited description
-
reporter - edited description
-
reporter - edited description
-
You have to use SQLiteNetExtensions.Extensions.
using SQLiteNetExtensions.Extensions;
At the top of your file. (the README should say this but doesn't, it took me a little while to figure it out.)
- Log in to comment