>Code2Code.net Home   >Contacts   >Credits   >Links   >Other Translation Engines

DbLinq Project: Linq Provider for MySql, Oracle and PostgreSQL

What is LINQ?

LINQ stands for Language-Integrated Query, which allows .NET programs (e.g. C# or VB.NET) to connect to databases.

It is an O/R (Object-Relational) mapping tool, with some similarities to Hibernate or LlblGen.  LINQ is type-safe, queries get compiled into MSIL on the fly, and your C# WHERE clauses are translated into SQL and sent to SQL server for execution. In short, it makes design of data access layers safer and faster. In C# 3.0, linq code looks like this:

 var q = from p in db.Products             
         where p.ProductName == "Pen"  
         select p.ProductID;           

Download

Latest source code is in subversion on code.google.com: svn page
Zipped releases are on the downloads page.

Coming in 2008 May:

Thomas Glaser contributing first part of Ingres support.
Pascal Crappone refactored entire codebase.
Bryan Livingstone started work on Visual Metal.

Older news

Douglas Six from France has ported the provider to SqlLite. Peter Magnusson from Sweden maintains it - thanks to both!

Status Update - 2008 Jan:

Oracle support is back - but it's tested on OracleXE only.
Please write to tell me if it works on regular Oracle.

We now have a newsgroup: http://groups.google.com/group/dblinq

Status Update - 2007 Nov:

1. Miguel de Icaza is considering adding this project to Mono - which required re-licensing under MIT license.
2. Suspended Oracle support, because my Oracle box died. The Oracle provider compiles, but status is unknown.
3. Added support for client-side enums.
4. Partial support for stored procedures and stored functions in MySql and PostgreSQL
5. BULK Insert support (using SqlBulkCopy) in MS provider, and multi-row insert in Mysql provider.
6. Bug fixes in 'IS NULL/ IS NOT NULL' clauses
7. Starting to add test cases from '101 Linq Samples' - please help (there is a C# version available also, but license says 'All Rights Reserved' - not sure if I can place it in this project). Failure rate: 18 out of 67.
8. Preparing a 2007-Nov source code release

Status Update - 2007 Sep:

1. New package supports Visual Studio 2008 (Orcas) Beta2. Download ver 0.11 here. My blog entry discusses the main changes.
2. Thanks to Bryan Livingston for the original package, ver 0.10.
3. Added support for PostgresSQL and Microsoft
4. Added support for GROUP BY, HAVING clauses.

How good is DB_Linq compared to Microsoft's LINQ-to-SQL?

DB_Linq is prototype software. Simple queries do work, complex ones probably not. That said, you are free to use it in your production code - just test everything thoroughly. 
Broken/missing functionality in this project: Transactions, subqueries, Linq-to-Entities etc.

In comparison, Microsoft LINQ-to-SQL is approaching production quality. Microsoft only supports MS Sql Server and Acces, but has nice GUI integration, has Linq-to-entities, and can call stored procedures.

The only two things that DB_Linq does better than MS: support for other vendors, and bulk insert.

Getting Started:

1. Download source code package, compile in Visual Studio.
2. edit and run script 'run_myMetal.bat' (or run_oraMetal or run_pgMetal) to generate a C# file representing your database
3. include DbLinq.Mysql.dll and the new file in your project (or DbLinq.Postgres.dll etc)

Links:

- Microsoft Visual Studio 2008 (Orcas) Beta2  (free download)
- Download source code package (ver 0.11) from code.google.com
- if you want to contribute, use
Subversion (or TortoiseSVN) to download source code from version control (Tortoise users can just click turtle picture on the right)
- MySql 5.0 and MySql query browser - to run the DB create script
- Alternately, download pgsql packages. 

Licence:

MIT license (formerly LGPL, changed to be compatible with Mono project)

Contact / Questions / Bugs / Comments:

Project lead: Jiri George Moudry, gmoudry@yahoo.com
A good way to contact us is on this forum: groups.google.com/group/dblinq
Optionally, you could also leave a message on my blog. Thanks.

Documentation

Linq (or DLinq) documentation can be found in the doc/ folder of your C# 3.0 installation.
Also, here is the Linq project home page [microsoft.com].
DB_Linq has currently no documentation.

Also:
Got mail from Oren from the NHibernate project. They are also working on a Linq interface, and making good progress. Oren writes:
  I have started to work on an implementation of Linq to NHibernate, you can see the current results here:
  http://www.ayende.com/Blog/archive/2007/03/17/Implementing-Linq-for-NHibernate-A-How-To-Guide--Part.aspx


xx
Locations of visitors to this page