映射列中的 NHibernate 错误
我的 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来文件中的外键引用的 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.