sql server - How to Specify a Constant Value NHibernate Criteria That Will Not Be Translated as an SQL Command Query Parameter -


i have nhibernate query uses following clause:

restrictions.eqproperty (     projections.property<cat>(c => c.byteproperty),     projections.constant(catbytepropertyvalues.value1) ) 

this restriction converted query parameter similar following

execute sp_executesql n'.... c_.byteproperty = @p0', n'@p0 tinyint', @p0=1... 

for specific query of interest, in order take advantage of index has filter on above property, value '1' hard-coded, rather explicitly parameterized, within resultant sql command.

for example, following see

execute sp_executesql n'.... c_.byteproperty = 1'... 

the root of query declared queryover. work the existing query sought answer, although such solution in nhibernate api marked helpful.

thank comments , answers.

the answer here projections.sqlprojection

restrictions.eqproperty (     projections.property<cat>(c => c.byteproperty),     projections.sqlprojection("1 one", new string[] {} , new itype[] {}) ) 

this generate inline sql statement without @parameter. check (as example) way how use custom sql criterions:


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -