Fixed in r1083.  The relevant logic is in
DataContext.GetCommand(IQueryable) and
DataContext.CreateDefaultQuery(IQueryable) -- if there are no
expressions on the IQueryable, we'll add an "identity" expression which
will allow the rest of DbLinq to work normally.  The created "identity"
expression tree is equivalent to doing .Select(e => e).

 - Jon

On Thu, 2009-05-21 at 15:43 +0200, Giacomo Tesio wrote:

> I've just committed a patch to enable the correct (I hope) management
> of some DbLinq use cases showed in
> ReadTest.C20_SelectEmployee_DbLinqAsQueryObject().
> 
> To pass this have required some modification to the SqlProvider base
> class: GetLiteralOr and GetLiteralXor now return their result between
> '(' and ')'. 
> For consistency (and imaging this could be also required in some other
> use case) I've added this behaviour to GetLiteralAnd.
> Since I've not yet the testing VM installed, I suggest who can to
> check for any vendors unit test regression that may appear.
> 
> Moreover I've submited two new failing test showing usecases that I
> ecountered while working to the previous one:
> - ReadTest.C21_SelectEmployee_DbLinqAsQueryObjectWithOrderCount()
> - ReadTest.C22_SelectEmployee_GetCommandTextWithNoFilter()
> 
> ReadTest.C22_SelectEmployee_GetCommandTextWithNoFilter() made me quite
> discouraged about DbLinq: how can be that no one have never do this?
> 
> ReadTest.C21_SelectEmployee_DbLinqAsQueryObjectWithOrderCount() is
> related to query production:
> for the given query Linq2Sql pruduce this
> 
> SELECT [t2].[EmployeeID], [t2].[LastName], [t2].[FirstName],
> [t2].[Title], [t2].[BirthDate], [t2].[HireDate], [t2].[Address],
> [t2].[City], [t2].[Region], [t2].[PostalCode], [t2].[Country],
> [t2].[HomePhone], [t2].[Photo], [t2].[Notes], [t2].[TitleOfCourtesy],
> [t2].[PhotoPath], [t2].[Extension], [t2].[ReportsTo]
> FROM [dbo].[Territories] AS [t0]
> INNER JOIN [dbo].[EmployeeTerritories] AS [t1] ON [t0].[TerritoryID] =
> [t1].[TerritoryID]
> INNER JOIN [dbo].[Employees] AS [t2] ON [t1].[EmployeeID] =
> [t2].[EmployeeID]
> WHERE ([t0].[TerritoryDescription] = @p0) AND (([t2].[FirstName] LIKE
> @p1) OR ([t2].[LastName] LIKE @p2)) AND (((
>     SELECT COUNT(*)
>     FROM [dbo].[Orders] AS [t3]
>     WHERE [t3].[EmployeeID] = [t2].[EmployeeID]
>     )) > @p3)
> 
> while DbLinq produce this (completely ignoring the count)
> 
> SELECT e$.[EmployeeID], e$.[LastName], e$.[FirstName], e$.[Title], e
> $.[BirthDate], e$.[HireDate], e$.[Address], e$.[City], e$.[Region], e
> $.[PostalCode], e$.[Country], e$.[HomePhone], e$.[Photo], e$.[Notes],
> e$.[TitleOfCourtesy], e$.[PhotoPath], e$.[Extension], e$.[ReportsTo]
> FROM [dbo].[Territories] AS t$
>  LEFT JOIN [dbo].[Orders] AS t1$ ON t1$.[EmployeeID] = e$.[EmployeeID]
>  INNER JOIN [dbo].[EmployeeTerritories] AS l$ ON t$.[TerritoryID] = l
> $.[TerritoryID]
>  INNER JOIN [dbo].[Employees] AS e$ ON l$.[EmployeeID] = e
> $.[EmployeeID]
> WHERE t$.[TerritoryDescription] = @territoryName AND (SELECT COUNT(*))
> > @minimumOrderNumber AND (e$.[FirstName] LIKE '%' + @namePart1 + '%'
> OR e$.[LastName] LIKE '%' + @namePart + '%')
> 
> I can't imagine where to start to fix this last behaviour.
> 
> 
> Giacomo
> 
> > 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DbLinq" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/dblinq?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to