This project is read-only.

Cannot perform mod inside linq

Topics: Troubleshooting, Writing modules
Mar 22, 2012 at 12:14 PM
Edited Mar 22, 2012 at 12:15 PM

I have a non-content record that I query using the IRepository, and it seems there is a (known) issue with using mod.

I have an int field that I need to check for some flags (using mod) and it nhibernate linq throws a 'null' exception.

Just assume a simple record with an 'Id' and 'Flags' field, and I need to do (for example) if ((Flags % 2) == 0)

Does anyone know an alternative way to perform a query that does the mod?

Some example would be greatly appreciated!

edit: Take note that I have too many records to 'just fetch them all' and do the filtering afterwards.

Mar 23, 2012 at 10:18 PM

You may want to try HQL. No promises though.