Details
Assignee
UnassignedUnassignedReporter
Frédéric DelaporteFrédéric DelaporteComponents
Affects versions
Priority
MinorWho's Looking?
Open Who's Looking?
Details
Details
Assignee
Unassigned
UnassignedReporter
Frédéric Delaporte
Frédéric DelaporteComponents
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created July 12, 2017 at 2:53 PM
Updated May 8, 2018 at 10:01 PM
Some methods are non-deterministic and should not be evaluated in the expression tree, once and for all resulting rows, but instead in the database. This is the case for
Guid.NewGuid()
andRandom.Next()
.Others may have distinct resulting values depending on the host on which they execute, and can change the query results depending on whether they are evaluated on db-client side or on db-server side. This is the case for
DateTime.Now
,DateTime.UtcNow
,DateTimeOffset.Now
,DateTimeOffset.UtcNow
.Currently they are always evaluated by NHibernate Linq provider before emitting the query with the resulting value as a parameter.
They should be left in the expression tree, and translated to appropriate HQL standard functions, then translated to corresponding database functions.
A user wishing to have them evaluated client side will then have to put their value in a variable then use that variable in its query.
By the way, for supporting this feature, when registering a method/property for the linq provider, we should be able to tell if it is partially evaluatable or not.