views:

228

answers:

1

I'm migrating a huge web application from SQL Server to MySql. The application uses Linq so i'm using DBLinq. Currently most things are working properly except for that on a few pages i get a strange error. It all started with this:

Property 'Int32 ForumID' is not defined for type 'DbLinq.Data.Linq.Table`1[CPost]'

I've obviously got a ForumID in the CPost class, so that isn't the problem. I tried copying the query to a separate file and started removing parts of it to see what caused the error. After a while i found out that this line:

var q = from u in db.Users select new {ab = u};

Caused a exception:

New

At the line:

throw new ArgumentException(operationType.ToString());
Source File:  D:\Visual Studio 2008\Projects\DbLinq\src\DbLinq\Data\Linq\Sugar\Implementation\ExpressionDispatcher.Analyzer.cs    Line:  858 

But this code:

var q = from u in db.Users select u;

Ran Perfectly.

I can provide more information if it's needed however i can't post the entire source code since it's quite huge (above 10,000 lines not counting html). Have anyone had similar problems to these?

EDIT: After some further investigation i found that DbLinq complains because it does not find the keyword New or MemberInit from the query

var q = db.Posts.Select(post => post);

Works while:

var q = db.Posts.Select(o => new SPost {Post = o});

and

var q = db.Users.Select(u => new {user = u});

Throws an exception. The exception is made at line 285 in trunk/src/DbLinq/Vendor/Implementation/SqlProvider.cs

A: 

I'd avoid using DBLinq for production code... many of Linq-To-SQL's features aren't implemented, and walking through the source code shows a low level of maturity... many of the methods are not implemented or marked as "unterminated".

...you've been warned!

Mark
so what to use in a MySql Project?
balint
http://stackoverflow.com/questions/951634/dblinq-cache-problem/1680771#1680771 http://stackoverflow.com/questions/760665/dblinq-not-generating-where-clause/1680766#1680766 http://stackoverflow.com/questions/1455064/dblinq-and-mono-2-4-working-together/1680768#1680768 http://stackoverflow.com/questions/558915/is-db-linq-non-sql-server-database-an-acceptable-substitute-for-linq-to-sql-wit/1680777#1680777 ... someone was unhappy ;-)
RedGlyph