59
votes

I have a small project that require a storage (I choose SQLite) and I got good result with the ADO DLL for .Net for Sqlite.

After the Install, I noticed that it contain a SQLLinq.dll. Before investigating too much effort, and because I haven't see any good example on the web, I would like to know if anyone got any good result with SQLite and LINQ?

*If linqtosql work the same way what ever the SQL database, let me know it. I was interesting with the Dll when I saw it because I never use Linqtosql before and I thought it would be a great opportunity to try,

9

9 Answers

50
votes

I've recently discovered DBLinq, which supports SQLite among other DB:

10
votes

From my own experience, Microsoft SQL Compact Framework is a REAL NO-GO. It is REALLY FREAKING slow and its Query Analyzer is just really poor. I had to ask my team to rewrite all the plumbing code of my Windows Mobile component to get rid of the awful performances of SQL CE.

8
votes

LINQ to SQL only supports SQL Server/Compact however it is possible the SQLite people have written their own LINQ provider given the name of the assembly.

If that's the case you would be able to use the LINQ query syntax by adding a reference to it but you wouldn't get LINQ to SQL specific features such as the DataContext/designer/SQL Metal/Column attributes/EntitySet/EntityRef etc.

4
votes

I know this question is old, but at this time, I think we can found an official implementation of SQLite support for .NET here : http://system.data.sqlite.org/index.html/doc/trunk/www/index.wiki. A good introductory article should be found here : http://www.codeproject.com/Articles/236918/Using-SQLite-embedded-database-with-entity-framewo

3
votes

This isn't an answer to your question as such, but as an alternative you could use SQL Compact:

http://www.microsoft.com/Sqlserver/2005/en/us/compact.aspx

Which has good LINQ-to-SQL support, and (despite the name) is great for desktop apps with small storage requirements.

2
votes

There's a package on NuGet called "LINQ to SQLite". I haven't tried it, but it seems fresh.

https://www.nuget.org/packages/linq2db.SQLite/

1
votes

With EntityFramework 7 the support for SqLite improved and it is possible to use the EntityFramework.Commands to create some migrations. Here is a Tutorial:

https://xamlbrewer.wordpress.com/2016/06/01/getting-started-with-sqlite-and-entity-framework-on-uwp/

As a prerequisite at least PowerShell3 should be installed.

0
votes

Since DBLinq is no longer maintained, I kept searching and found this answer which sort of unclearly points to a solution using Linq to Sql, Entity Framework, and SQLite. The blog post he links to is a little out of date, but with some tweaks I got a working example up on GitHub.

It should run OOTB in Visual Studio 2013. It shows adding a record (with related record in another table), modify, and delete. The Artist and Album classes represent records in their respective tables (part of the Entity Framework, I believe). See the readme for a few gotchas to watch out for.