SQLite3 in C#.NET

巧了我就是萌 提交于 2019-12-21 21:27:38

问题


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! :)


回答1:


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.




回答2:


(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.




回答3:


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




回答4:


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



来源:https://stackoverflow.com/questions/1145190/sqlite3-in-c-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!