我无法从这个NHibernate映射中获取记录

本文关键字:映射 获取 记录 NHibernate | 更新日期: 2023-09-27 18:07:02

<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <class name="CITI.manageID.Data.Entities.AuthUserKioskRoleMap,CITI.manageID.Data" table="AuthUserKioskRoleMap" lazy="false">
    <composite-id name="Id" class="CITI.manageID.Data.Entities.AuthUserKioskRoleMapId,CITI.manageID.Data">
      <key-many-to-one name="AuthUsers" class="CITI.manageID.Data.Entities.AuthUsers,CITI.manageID.Data" column="UserID" />
      <key-many-to-one name="KioskInfo" class="CITI.manageID.Data.Entities.KioskInfo,CITI.manageID.Data" column="KioskID" />
      <key-many-to-one name="AuthRole" class="CITI.manageID.Data.Entities.AuthRole,CITI.manageID.Data" column="Roleid" />
    </composite-id>
    <property name="Status" column="Status" type="string" />
    <property name="CreatedBy" column="CreatedBy" type="string" not-null="true" />
    <property name="CreatedOn" column="CreatedOn" type="DateTime" not-null="true" />
    <property name="UpdatedBy" column="UpdatedBy" type="string" />
    <property name="UpdatedOn" column="UpdatedOn" type="DateTime" />
    <many-to-one name="AuthRole" column="Roleid" cascade="save-update" not-null="true" />
    <many-to-one name="AuthUsers" column="UserID" cascade="save-update" not-null="true" />
    <many-to-one name="KioskInfo" column="KioskID" cascade="save-update" not-null="true" />
  </class>
</hibernate-mapping>

I have try following

ICriteria crit = SessionRepository.CreateRepositoryCriteria(typeof(AuthUserKioskRoleMap));
crit.Add(Expression.InsensitiveLike("AuthUsers.Userid", AuthUserID));
crit.Add(Expression.InsensitiveLike("KioskInfo.Kioskid", KioskID));
crit.Add(Expression.InsensitiveLike("Id.AuthUsers.Status", "A"));
crit.Add(Expression.InsensitiveLike("Id.KioskInfo.Status", "A"));
crit.Add(Expression.InsensitiveLike("Id.AuthRole.Status ", "A"));
crit.Add(Expression.InsensitiveLike("Status", "A"));
crit.AddOrder(new Order("ImageType", true));
ApplicantFaceInfoList = crit.List<AuthUserKioskRoleMap>();

请帮

我无法从这个NHibernate映射中获取记录

这个映射文件被称为AuthUserKioskRoleMap.hbm.xml并被设置为Visual Studio中的可嵌入对象吗?

注意hbm.xml扩展,因为这很重要。

如果这仍然不能工作,那么请提供更多的信息,例如任何错误和/或配置代码。