ericsink / SQLitePCL.raw

A Portable Class Library (PCL) for low-level (raw) access to SQLite
Apache License 2.0
525 stars 109 forks source link

Can this be used with ADO.net ? #305

Closed pha3z closed 4 years ago

pha3z commented 4 years ago

I want to use the ADO.net approach to providing a DbProvider. I want to be able to make my application run agnostic to sqlite or another sql database.

Apache shows an example of how to use System.Data.Sqlite.DLL with ADO.net here: http://system.data.sqlite.org/index.html/artifact/96f3932f9f371cca

But I can't figure out how to do it with the Green Bundle or with the SqlitePcl Raw lib in general.

Do you know how to do this?

I made an attempt to wire up things manually (forgoing the proper ADO.net workflow), but I can't even figure how to properly use the Green Bundle after I call Batteries.Init(). Once I've initialized it, what do I actually do to get a reference to a database instance to start working with?

ericsink commented 4 years ago

For an ADO.NET API built on this library, use Microsoft.Data.Sqlite instead of System.Data.Sqlite.

bricelam commented 4 years ago

NuGet Package: https://www.nuget.org/packages/Microsoft.Data.Sqlite API Docs: https://docs.microsoft.com/dotnet/api/microsoft.data.sqlite Samples: https://github.com/aspnet/EntityFrameworkCore/tree/master/samples/Microsoft.Data.Sqlite Source: https://github.com/aspnet/EntityFrameworkCore/tree/master/src/Microsoft.Data.Sqlite.Core Issues: https://github.com/aspnet/EntityFrameworkCore/labels/area-adonet-sqlite

pha3z commented 4 years ago

Thank you. Immensely helpful!

bricelam commented 4 years ago

Docs: https://docs.microsoft.com/dotnet/standard/data/sqlite/