I have replaced all my NHibernate xml mapping files by loquacious mappings (mapping by code). The only thing I can't figure out is if it is possible to define this named query using loquacious mappings:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping namespace="Domain" assembly="Domain" xmlns="urn:nhibernate-mapping-2.2">
<sql-query name="MyFunction">
<query-param name="Inputparam1" type="Int32"/>
<query-param name="Inputparam2" type="Int32"/>
<return-scalar column="ResultParam" type="Int32"/>
<![CDATA[ select MyFunction(:Inputparam1,:Inputparam2) as ResultParam ]]>
</sql-query>
</hibernate-mapping>
Does anyone know if it's possible, and so how to do it or point me in the right direction?
Thanks in advance, Regards, Ted
You can still mix your mappings, that is use all the new juiciness of mapping by code and still have some of your HBM named mapping files.
The solution is quite simple, first you need to define your web.config (or external nhibernate config file) as:-
Then configure NHibernate accordingly:-
I have written a blog post regarding this.