59

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 Answers 9

50

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

Sign up to request clarification or add additional context in comments.

4 Comments

this one should be the answer, it's the only LINQ<->SQLite that I've found that looks good
It's the only LINQ to SQL provider to databases other than SQLServer that i've found
I changed the answer. Back in the time it this answer wasn't there but now it's obviously the best one.
Check Mono project. If i recall correctly they had a LINQ sqlite adapter written in c# Anyway, try the adapter even if its old, maybe it still works, and you have the source after all :)
10

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.

1 Comment

I 100% agree--- CE is a piece of garbage... hence, why i am looking for an alternative (SqlLite) -- Don't get me started on why its so bad... just don't use it in any kind of high volume multi threaded environment.
8

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.

1 Comment

Alright thx for the information. I'll mark you as answer if by the end of the day no one have a better answer ! +1
4

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

Comments

3

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 Comments

+1 I will keep Sqlite but you learn me something new with Compact!
2

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/

Comments

1

this is a good linq to sqlite..

http://www.devart.com/dotconnect/sqlite/

Comments

1

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.

Comments

0

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.