views:

53

answers:

1

I have the following code:

if (collection["Filter"] == "2") { 
   presentations = presentations.Where(x => x.Speaker.FirstName.StartsWith("B")).
   OrderBy(x => x.Speaker.FirstName);
}

this generates the following sql:

SELECT  [t0].[Description], [t0].[EventId], [t0].[Id], [t0].[PresentedOn], 
        [t0].[Slug], [t0].[SpeakerId], [t0].[Title], [t0].[Url]
FROM    [Presentations] AS t0
LEFT    OUTER JOIN [Speakers] AS t1 ON ([t1].[Id] = [t0].[Id])
WHERE   ([t1].[FirstName] LIKE 'B' + '%')
ORDER   BY [t1].[FirstName]

The problem is the join should be:

LEFT OUTER JOIN [Speakers] AS t1 ON ([t1].[Id] = [t0].[SpeakerId])

Any ideas how to correct this problem? Linked to http://stackoverflow.com/questions/3262155/asp-net-mvc2-linq-where-clause-using-startswith

A: 

I don't think the SubSonic Linq provider is very 'mature'.

Craig
I appreciate you comment, but it's not very helpful. This is not the first problem with subsonic and I will agree with you though.
Daniel Draper
Not an answer. Did you intend for this to be a comment on the OP instead?
allonym