Reputation: 3236
I want to use in NHibernate the "SQL Server template" for named parameters that is a "@" instead of the ":" ?
For example I want to use this:
select * from Users where ID = @id
instead of this:
select * from Users where ID = :id
This will be much useful for moving the query in .hbm.xml files from/to to the SQL editor.
There is a way to set the special character of the named parameter template?
Thanks,
Alessandro
Upvotes: 1
Views: 433
Reputation: 25628
The colon is a hard-coded constant in the NHibernate source code (see NHibernate.Hql.ParserHelper.HqlVariablePrefix). So you would probably need to look carefully through and change a lot of source code. You would have to hope that all the source code uses the constant... I would guess there could be lots of instances where this is not the case. Unfortunately the NHibernate code is not always that pretty.
There are probably better alternatives (e.g. using a macro in your text editor to quickly make the replacement).
Upvotes: 1