Noah Hart has published his port of SQLite to C#. The project is called C#-SQLite. The main SQLite author, D Richard Hipp, originally said that the project should not include SQLite anywhere in its name, but has now relented:
I think I would be comfortable with a name like C#-SQLite. The prefix makes it clear that it is a reimplementation, not the original. People notice prefixes much more readily than suffixes. There is also precedent for changing a prefix for a reimplementation. Lucene, for example, was ported to C-Lucene. I’m sure there are others.
The whole point of this exercise it to avoid confusing people. Folks who use C#-SQLite need to be fully aware that what they are using is distinct and separate from the original SQLite. As long as that one condition is met, I am happy.
I downloaded the code, compiled in Visual Studio 2008 (requires project conversion), ran the shell and tried a couple of commands. It works!
Of course there are already a million ways to use SQLite from .NET, but they all require platform invoke to native code, which is not allowed in some scenarios for security and/or cross platform reasons – Silverlight being a prime example.
Next question: how hard will it be to get this working in a Silverlight project?
See also SQLite C# port raises hopes for a Silverlight local database manager which has some early performance results.
You might be interested to know that there is another alternative for a local database manager for Silverlight, that potentially fits in better with the object-oriented environment of C#: Perst. See http://tinyurl.com/lusd4h
Tim,
One of the things I liked about Mono was that it supported the real SQLite out of the box… As a result I tended to favour Mono over .NET especially for any console applications/servers.
However if this C# port is any good then it will help a lot!
A question for you… In the absence of SQLite in C# what database system would you recommend for local storage? SQL Server Compact?
Thanks, Gary
Gary
You can use sqlite with Microsoft .NET, in fact that is what I would suggest. There are a few annoyances with SQL Server Compact, or were last time I tried it.
Tim