We have a value stored in our database. This value is of data type float
.
Our application uses NHibernate Criteria to query the database.
When querying this value, we want to filter on a value, say 66.66.
The database will contain the value 66.6666667
So, when querying, we want to truncate (not round up) the value to two places, so that if we query on 66.66, we get all records where the truncated value equals 66.66.
In SQL Server, we could use the following query to truncate the value:
CAST(ROUND(CAST([Score] AS DECIMAL (13,5)), 2, 1) AS FLOAT) = 66.66
Is there any way to do the same query using NHibernate criteria?