I’m just getting started with ORMLite and am not super familiar with the API so please bear with me if this is a simple question.
I typically write my filter queries using the following pattern:
create procedure FindThings
@field1Filter varchar(50) = null
@field2Filter varchar(50) = null
as
begin
select *
from MyTable
where (@field1Filter is null or Field1 = @field1Filter)
and (@field2Filter is null or Field2 = @field2Filter)
end
Is there an equivalent way to achieve this in ORMLite other than writing it out as a stored procedure and then calling the stored procedure? This is specifically for SQLServer
I ended up needing to make some modifications to the query you provided but was able to get it working. Kept getting a cannot convert lambda expression because it is not a delegate type on the q.Where and wasn’t able to find a fix.