映射列中的 NHibernate 错误

发布于 2024-12-19 21:00:04 字数 1382 浏览 0 评论 0原文

我的 hbm.xml 文件如下:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Project.Data.BusinessObjects" assembly="Project.Data">
  <class name="Project.Data.BusinessObjects.HSBom, Project.Data" table="[dbo].[HS_Bom]" lazy="true">
    <id name="Id" column="[bomID]">
      <generator class="assigned" />
    </id>
    <property name="BomPosition" column="[bomPosition]" />
    <property name="Quantity" column="[quantity]" />
    <property name="CreatedBy" column="[createdBy]" />
    <property name="CreatedAt" column="[createdAt]" />
    <property name="UpdatedBy" column="[updatedBy]" />
    <property name="UpdatedAt" column="[updatedAt]" />
    <many-to-one name="HSPartList1" column="[parentPartListId]" class="HSPartList" />
    <many-to-one name="HSPartList2" column="[childPartListId]" class="HSPartList" />
    <bag name="HSInstructions" table="[dbo].[HS_SubParts]" lazy="true" cascade="all" inverse="false" >
      <key column="[bomID]"></key>
      <many-to-many column="[sectionID]" class="HSInstruction" />
    </bag>
  </class>
</hibernate-mapping>

当我运行我的应用程序时出现错误: Project.Data.HbmMaps.HSBom.hbm.xml(17,17):XML 验证错误:未声明“column”属性。

映射 xml 有什么问题?

My hbm.xml file is as follows:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Project.Data.BusinessObjects" assembly="Project.Data">
  <class name="Project.Data.BusinessObjects.HSBom, Project.Data" table="[dbo].[HS_Bom]" lazy="true">
    <id name="Id" column="[bomID]">
      <generator class="assigned" />
    </id>
    <property name="BomPosition" column="[bomPosition]" />
    <property name="Quantity" column="[quantity]" />
    <property name="CreatedBy" column="[createdBy]" />
    <property name="CreatedAt" column="[createdAt]" />
    <property name="UpdatedBy" column="[updatedBy]" />
    <property name="UpdatedAt" column="[updatedAt]" />
    <many-to-one name="HSPartList1" column="[parentPartListId]" class="HSPartList" />
    <many-to-one name="HSPartList2" column="[childPartListId]" class="HSPartList" />
    <bag name="HSInstructions" table="[dbo].[HS_SubParts]" lazy="true" cascade="all" inverse="false" >
      <key column="[bomID]"></key>
      <many-to-many column="[sectionID]" class="HSInstruction" />
    </bag>
  </class>
</hibernate-mapping>

When I run my application am getting an error:
Project.Data.HbmMaps.HSBom.hbm.xml(17,17): XML validation error: The 'column' attribute is not declared.

Whats is the issue with the mapping xml?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

筱果果 2024-12-26 21:00:04

看起来文件中的外键引用的 hbm 文件有问题,被视为“内容”资源而不是嵌入资源。您可以通过 Visual Studio 解决方案资源管理器右键单击 hbm 文件并将构建操作从相应 hbm 文件的“内容”更改为“嵌入式资源”来执行相同的操作。

在此处输入图像描述

Looks like its an issue with the hbm file/files for the foreign key references in your file being treated as 'Content' resources rather than embedded resources. You can do the same by right clicking on the hbm file though your visual studio solution explorer and changing build action to 'embedded resource' from 'content' for the appropriate hbm files.

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文