DbLinq issues (Keyword New or MemberInit throws exception)

I am migrating a huge web application from SQL Server to MySql. The app uses Linq, so I am using DBLinq. Most things are working fine nowadays, except that I get a strange error on a few pages. It all started with this:

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

      

I obviously got the ForumID in the CPost class, so this is not a problem. I tried to copy the request into a separate file and started deleting 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};

      

Thrown Exception:

New

      

In 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;

      

Excellent.

I can provide more information if needed, but I cannot post the entire source code as it is quite large (over 10,000 lines excluding the html). Has anyone had similar problems?

EDIT: After some further investigation, I found that DbLinq is complaining because it doesn't find the New or MemberInit keyword from the request

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 line 285 in trunk / src / DbLinq / Vendor / Implementation / SqlProvider.cs

0


a source to share


1 answer


I would not use DBLinq for production code ... many Linq-To-SQL features are not implemented, and walking through the source code shows a low level of maturity ... many of the methods are not implemented or are marked as "unterminated".



... you've been warned!

0


a source







All Articles