tags:

views:

5589

answers:

10

Would someone explain how to get LINQ working with Sqlite.

A: 

Check this provider:

SqlLite Linq Provider

Also you can consider using SQL Compact which has very good LINQ-to-SQL support.

CMS
Linq is missing a critical ZIP.
jcollum
+1  A: 

Yup there is a SqlLite Linq Provider as mentioned by CMS

Check out SQL server compact and it works well with Linq

There is another thread on SO which you should check

Vin
Thanks for adding this. I had read this before posting my own question but still didn't understand how do get Linq working so I decised to write up the question myself.
minty
A: 

I would like to add that you can use Linq to Sql with SqlLite with a couple of stipulations:

  1. You cannot use the Linq to Sql designer which means you have to hand roll your classes.
  2. You have to be careful not to do certain operation which will result in Sql code which is not supported by SqlLite.

For example, you cannot use FirstOrDefault() in any of your Linq queries because it will result in something like:

select top 1 * from table where ...

Since SqlLite doesn't support the "top 1" syntax, you will gt a runtime Sql error.

Other than that, I have been using Linq to Sql with SqlLite with great success for basic CRUD operations.

lfoust
+3  A: 

The link provided by CMS doesn't work anymore. I have used this one as it now seems to be baked into their SQL lite ADO .NET provider.

Unfortunately they still don't support the designer mode of VS for creating classes :(

Also be aware that SQL Server compact doesn't support the design mode for LINQ classes! However if you want to use the entity framework the designer does work for SQL lite and SQL Server compact :)

Alex
A: 

Check out our LINQ to SQLite implementation.
You can find an overview here.

Devart
A: 

On this time there is NO good tools to do this!

LINQ providers for SQLite all is in alpha stage (for example:dblinq2007). And it is very big risk to use it in commercial purpose! So maybe in future...

If you want ot use ADO.NET there is good ove: phxsoftware.

Sasha
+3  A: 

Joe Albahari's LINQPad now supports Sqlite: http://www.linqpad.net/Beta.aspx. The one LINQ tool to rule them all.

ebpower
Sweet, @ebpower thanks for the update
minty
You're welcome. Any chance you could close this question out?
ebpower
A: 

You can use this: http://code.google.com/p/dblinq2007. Although it looks like the project is still in Alpha stage, IMO it is actually very stable now. Of course if you have a huge project, it is better to consider using something else like MySQL or SQL Compact. I don't like SQL Server, because it is too bloated, and offers not many more functionalities over SQL Compact or MySQL

Quang Anh