How to Use Linq with a MySQL Database on Mono

How can I use Linq with a MySql database on Mono?

The only (free) linq provider for MySql is DbLinq, and I believe it is a long way from production-ready.

There is also MyDirect.Net which is commercial, but I have heard mixed reviews of it's capability.

I've read that MySql will be implementing the Linq to Entities API for the 5.3 version of the .net connector, but I don't know if there's even a timeline for that. In fact, MySql has been totally silent about Entity Framework support for months.


Addendum: The latest release of the MySql Connector/Net 6.0 has support for the EF according to the release notes. I have no idea how stable/useful this is, so I'd love to hear from anybody who have tried it.

Getting Linq to play nice with Mysql and Mono, is it possible?

I don't know why everybody seems to think that LINQ to SQL is not working on Mono.

Mono evolves regularly: as of today, LINQ to SQL works fine with Mono and MySQL (and I use it successfully with PostgreSQL).

There is a little error in your code: you don't specify the DbLinqProvider in the connection string. This is required in order to produce SQL code targeted at MySQL.

In this case, the generated SQL code is specific to SQL Server :

"FROM [test].[Users]"

should have been

"FROM `test`.`Users`"

Try to add "DbLinqProvider=MySql" in your connection string. This should fix your problem.

See : http://www.mono-project.com/Release_Notes_Mono_2.6#LINQ_to_SQL

You should be aware that the Mono/DbLinq implementation is still incomplete (for example, compiled queries aren't supported), but more than enough to develop a complete application.

Linq to sql monodevelop

Turns out that the problem was with mysql so i changed my database to sqlite and everything is okay now. but still don't know why it doesn't work with mysql.

How to use DbLinq SqlMetal for MySQL on Mac?

Find and edit your sqlmetal.exe.config and replace the settings not to use ByteFX (LONG unsupported) and use MySql.Data.

Remember to include the fully qualified assembly name, in my case that line looks like:

provider name="MySQL" dbLinqSchemaLoader="DbLinq.MySql.MySqlSchemaLoader, System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" databaseConnection="MySql.Data.MySqlClient.MySqlConnection, MySql.Data, Version=6.2.3.0, Culture=neutral, PublicKeyToken=2f3544035097bf97"

(I have MySql Connector installed with that version and token)

Regards

LINQ2Entities with MySQL on Mono

Mono does not supply an implementation of the Entity Framework, and (currently) has no plans to implement it in the near future, due to the abundance of high-quality and cross-platform ORM frameworks already in existence for the CLR. NHibernate and LINQ to SQL, for example.

(This is not speculation and was overheard in #mono coming from one of the Mono team members.)


Update 2012-10-03: Microsoft has released EF under the Apache 2.0 license (source), and the Mono project bundles it starting with version 2.11.3 (which is an alpha release at the time of this writing).

Dynamic LINQ with other databases

Here is the DBLinq project: http://code.google.com/p/dblinq2007/

DbLinq is THE LINQ provider that allows to use common databases with an API close to Linq to SQL. It currently supports (by order of appearance): MySQL, Oracle, PostgreSQL, SQLite, Ingres, Firebird

Whether these providers execute Count() in the way you describe depends on the quality of the provider, I suppose. Presumably some effort is made at optimization.

See also http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx

LINQ for PostgreSQL or MySQl

There is DbLinq, already integrated in Mono (since 2.6). Also has an SqlMetal.exe implementation for generation of contexts.

LINQ to MySql Data Provider

It doesn't exist. There is currently a project called DBLinq as part of the Mono Olive project to add support for other providers, but currently the only server that works is Microsoft's SQL Server.



Related Topics



Leave a reply



Submit