今天在使用nhibernate进行视图查询的时候发现所查询出来的数据居然全部都是相同的,不知道大家有谁用过nhibernate视图查询....
映射文件给大家看下,顺便说下我使用的数据库是mssql2005,nhibernate的版本是1.2
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="YQKC_ERP.Models.ViewUserRight,YQKC_ERP.Models" table="ViewUserRight">
<id name="Id" type="Int32" unsaved-value="null">
<column name="id" length="4" sql-type="int" not-null="true"/>
<generator class="native" />
</id>
<property name="UserName" type="String" column="userName" />
<property name="RoolName" type="String" column="roleName" />
<property name="RightId" type="Int32" column="rightId" />
<property name="RightParentCode" type="Int32" column="right_parent_code" />
<property name="RightType" type="Int32" column="right_type" />
<property name="RightText" type="String" column="right_text" />
<property name="RightUrl" type="String" column="right_url" />
<property name="RightTip" type="String" column="right_tip" />
</class>
<sql-query name="view_userRight_proc">
<return class="YQKC_ERP.Models.ViewUserRight,YQKC_ERP.Models" />
exec view_userRight_proc ?
</sql-query>
</hibernate-mapping>
有用到过的朋友最好能发下源码看下,不胜感激!