Nhibernate 调用存储过程
XML映射:
<?xml version="1.0" encoding="utf-8"?><hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <class name="**.**.**,**.Model" table="Data_CodingContentInfo" lazy="true"> <id type="string" length="50" name="id" column="ID" > <generator class="assigned" /> </id> <property type="string" length="50" name="code" column="Code" /> <property type="string" length="50" name="codinginfoid" column="CodingInfoID" /> <property type="string" length="50" name="codingcontentcn" column="CodingContentCN" /> <property type="string" length="50" name="codingcontenten" column="CodingContentEN" /> <property type="string" length="50" name="adduserid" column="AddUserID" /> <property type="DateTime" length="23" name="adddate" column="AddDate" /> <property type="string" length="50" name="edituserid" column="EditUserID" /> <property type="DateTime" length="23" name="editdate" column="EditDate" /> </class> <sql-query name="pro_GetStock "> <return-scalar column="stocktype" type="string" /> <return-scalar column="drugname" type="string"/> <return-scalar column="spec" type="string"/> <return-scalar column="equalcount" type="string"/> <return-scalar column="baseunit" type="string"/> <return-scalar column="company" type="string"/> <return-scalar column="date" type="string"/> <return-scalar column="id" type="string"/> <return-scalar column="perprice" type="string"/> <return-scalar column="batchnumber" type="string"/> <return-scalar column="innumber" type="string"/> <return-scalar column="inmoney" type="string"/> <return-scalar column="outnumber" type="string"/> <return-scalar column="outmoney" type="string"/> <return-scalar column="stocknumber" type="string"/> <return-scalar column="stockmoney" type="string"/> <return-scalar column="remark" type="string"/> exec pro_GetStock @where=:where </sql-query></hibernate-mapping>
public IList<object[]> GetReport(string where) { return Session.GetNamedQuery("pro_GetStock").SetString("where", where).List<object[]>(); }