I have never used the LLBLGen library / structure ... But this is probably the same problem that occurs with Entity Framework / LINQ-to-SQL: you cannot use C # query methods: the query should be executed by your db server, not locally, and your db server doesn't know how to execute C # code. So the problem would be in **WeekOf(i.StartDate)** == weeknr part of the code (this is the only BinaryExpression your request)
The exception that you posted is very clear that the point of error is the one I proposed. Then the reason is probably the one I gave you.
Taken from https://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=22861
If you are using SQL Server that supports DATEPART(isowk, ...) (or if you have MySQL that supports WEEK(...) )
public class SQLFunctionMappings : FunctionMappingStore { public SQLFunctionMappings() { Add(new FunctionMapping( typeof(SQLFunctions), "WeekOf", 1, "DATEPART(isowk, {0})")
and then you will use it like:
Where there is a line with LinqMetaData meta = new LinqMetaData(adapter) , add:
meta.CustomFunctionMappings = new SQLFunctionMappings();
and change where :
where SQLFunctions.WeekOf(i.StartDate) == weeknr
Here is a list of functions already displayed by llblgen, and how to map other functions.
source share