tags:

views:

130

answers:

2

Hi guys, I need to extend a subsonic generated (using linq templates) I have created the class with the same name and namespace in the same project when I run a query like this

IMBDB db=new IMBDB();
var r = (from query in db.Articles
        join cat in db.ArticleCategories on query.CategoryID equals cat.ID
        where query.ID == articleId select new Article()
        {
            CategoryName = cat.Description,
            ID = query.ID
        });            
        return r.SingleOrDefault();
//The CategoryName is created in the extended partial class is always null
//while the generated sql is as expected

SELECT [t0].[ID], [t1].[Description] FROM [dbo].[Articles] AS t0
INNER JOIN [dbo].[ArticleCategories] AS t1
ON ([t0].[CategoryID] = [t1].[ID])
WHERE ([t0].[ID] = 40)

Any ideas how to correct this?

Thanks

A: 

It seems that you are missing the select portion of the statement

FernandoZ
still same result with thisvar r = (from query in db.Articles join cat in db.ArticleCategories on query.CategoryID equals cat.ID where query.ID == articleId select new Article() { CategoryName = cat.Description, ID = query.ID }); return r.SingleOrDefault();
Sammy
+2  A: 

There's a really annoying bug that I think I have a patch for - long story short I took a patch over the last few months that hosed projections and I have no idea where the bug is in the sea of Linq crazy-code. Yes, this makes me very anxious in case you're wondering.

I had a nice person send me an email with code file attachments (instead of a patch) and I need to diff them, I'm just flat out of time. However I think that the issue has been addressed in a recent patch as well. So, if you download the latest source it may very well be fixed. If not - then I need to get that damn patch put in place and push 3.0.4 pronto.

Rob Conery
Rob,I downloaded the latest code and unfortunately gotten the same results.Thanks
Sammy