Linqer dont Convert T-Sql query

1.2k Views Asked by At

I using linqer want this sql to liqn query but i have problem

 select * from Project where Id in (select Top 3 ForeignId from ActivityLog
 group by ForeignId order by count(*) desc)

Problem :SQL cannot be converted to LINQ: Field [Id in (select Top 3 ForeignId from ActivityLog group by ForeignId order by count(*) desc)] not found in the current Data Context.

1

There are 1 best solutions below

0
On

I just had a similar issue with linqer. I found the solution was removing the ; after the SQL query and trying again.

It could be an issue with your context.
See Linqer – a nice tool for SQL to LINQ transition for instructions on setting up the context.
Also, make sure the *.dbml and *.designer.cs files are up to date and define the Project table to contain an Id column and the ActivityLog table to contain a ForeignId column.

This could be a bug with the version of linqer you are using. I am using 4.0.3 and was able to run the same query (adjusted to use my tables) without issue.