SQLite3 in C#.NET

2019-04-12 02:51发布

I'm trying to use SQLite3 in C#.NET. I've googled around and found some different API's. I also checked SQLite's website for wrappers. I like them, but want to write my own wrapper without using an added dependency. All wrappers I find that don't require an added dependency aren't free.

I'm wondering how one would read from, execute, and write to a sqlite3 database. Is it a socket connection(tcp? udp? etc?)? I've tried searching this answer on google and all I get are library-specific answers. :/ SQLite's website docs aren't much help either.

EDIT: I also found a COM interface while googling, but is that library specific?

Thanks SO! :)

4条回答
混吃等死
2楼-- · 2019-04-12 03:20

Have you looked at the System.Data.SQLite library? It's a free ADO.NET library to interact with SQLite and requires nothing else in order to run, since it has the engine built into it.

I've been using it for a while now and find it really easy to work with. It even has a plugin for Visual Studio should you decide to use some strongly-typed tables with it or want to use it to add/create tables.

查看更多
forever°为你锁心
3楼-- · 2019-04-12 03:29

System.Data.SQLite is comparatively slower than other providers like SqlClient. I have look into its code.

Now I want to call it throw P/Invoke but not like SQLite provider. It call through P/Invoke every time when ever you access column value through DataReader

查看更多
放荡不羁爱自由
4楼-- · 2019-04-12 03:30

(Answering the "socket connection" question.)

Part of the point of SQLite is that it's an embedded database - there's no server to talk to, you load the library directly into your process and it talks to the file system directly.

查看更多
不美不萌又怎样
5楼-- · 2019-04-12 03:32

If you want to use SQLite in .NET, you should take a look at System.Data.SQLite, which is a ADO.NET provider for SQLite

查看更多
登录 后发表回答