Dapper
Dapper copied to clipboard
Is Dapper.Rainbow not supporting SQLite?
When I use Dapper.Rainbow for SQLite, the following message appears: System.Data.SQLite.SQLiteException: "SQL logic error No such table: INFORMATION_SCHEMA.TABLES" Is Dapper.Rainbow not supporting SQLite?
The code show as below:
class Program
{
static void Main(string[] args)
{
string fileName = "MyDatabase.db";
if (!File.Exists(fileName)) SQLiteConnection.CreateFile(fileName);
SQLiteConnection connection = new SQLiteConnection($"Data Source = {fileName}");
MyDatabase db = MyDatabase.Init(connection, 2000);
db.Execute("CREATE TABLE IF NOT EXISTS Cat(Id integer PRIMARY KEY AUTOINCREMENT, Name text NOT NULL)");
db.Cats.Insert(new Cat { Name = "Tom" });
}
}
class MyDatabase:Database<MyDatabase>
{
public Table<Cat> Cats { set; get; }
}
class Cat
{
public int? Id { set; get; }
public string Name { set; get; }
}
I have the same issue, so this is a bug. SQLite doesn't have a table called INFORMATION_SCHEMA.TABLES updated the code to detect if it is a SQLite connection. Created Pull Request #1095
Ran into this today, not nice. Rainbow seems to do same job as Dapper.Contrib? Which is also unmaintained. Please just add a note to the readme stating it only works with SQL Server.