I am writing an L2E query to compare two GUID values.It simply doesn't allow direct comparison, and also .ToString() method is not allowed on L2E queries.. How can we achieve this?
I don't know if this applies to your case, but I found that I can use the Guid.CompareTo method in Linq, and it properly converts this to SQL.
documentQuery.Where(s => s.DocumentGuid.CompareTo(MyGuidVariable) > 0);
This produces the following SQL:
AND ([Extent1].[DocumentGuid] > @p__linq__1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With