Ormlite with LoadSelect is not using parametrized query
var exceptionsQuery = await
Db.From<ResourceTimeException>()`
.Join<ResourceTimeException, ResourceTimeExceptionResourceRelation>((t, r) =>
t.Id == r.ResourceTimeExceptionId && t.CompanyId == r.CompanyId &&
rids.Contains(r.ResourceId))
.Where(e => e.CompanyId == companyId &&
((e.From >= interval.From.AtMidnight() && e.From <= interval.To.AtEndOfDay())
|| e.To >= interval.From.AtMidnight() && e.To <= interval.To.AtEndOfDay())
|| (e.From <= interval.From.AtMidnight() && e.To >= interval.To.AtEndOfDay()))
.DbLoadSelectAsync(Db);
This is the output to sql
exec sp_executesql N'SELECT "ApplicationId", "ResourceTimeExceptionsId", "ResourceId", "Id", "ModifiedDate"
FROM "ResourceTimeExceptionResource"
WHERE "ResourceTimeExceptionsId" IN (SELECT "ResourceTimeExceptions"."ResourceTimeExceptionsId"
FROM "ResourceTimeExceptions"
INNER JOIN "ResourceTimeExceptionResource" ON
((("ResourceTimeExceptions"."ResourceTimeExceptionsId" = "ResourceTimeExceptionResource"."ResourceTimeExceptionsId")
AND ("ResourceTimeExceptions"."ApplicationId" = "ResourceTimeExceptionResource"."ApplicationId"))
AND "ResourceTimeExceptionResource"."ResourceId" IN (4))
WHERE ((("ResourceTimeExceptions"."ApplicationId" = CAST(''00000000-0000-0000-0000-000000000001'' AS UNIQUEIDENTIFIER))
AND ((("ResourceTimeExceptions"."ExceptionFromDate" >= ''20231020 00:00:00.000'')
AND ("ResourceTimeExceptions"."ExceptionFromDate" <= ''20261227 23:59:59.000''))
OR (("ResourceTimeExceptions"."ExceptionToDate" >= ''20231020 00:00:00.000'')
AND ("ResourceTimeExceptions"."ExceptionToDate" <= ''20261227 23:59:59.000''))))
OR (("ResourceTimeExceptions"."ExceptionFromDate" <= ''20231020 00:00:00.000'')
AND ("ResourceTimeExceptions"."ExceptionToDate" >= ''20261227 23:59:59.000''))))',
N'@0 int,@1 uniqueidentifier,@2 datetime,@3 datetime,@4 datetime,@5 datetime,
@6 datetime,@7 datetime',@0=4,@1='00000000-0000-0000-0000-000000000001',
@2='2023-10-20 00:00:00',@3='2026-12-27 23:59:59',@4='2023-10-20 00:00:00',
@5='2026-12-27 23:59:59',@6='2023-10-20 00:00:00',@7='2026-12-27 23:59:59'