NHibernate:未能找到元素“urn:nhibernate-mapping-2.0:hibernate-mapping”的架构信息。

边城的刀声 2007-10-18 10:09:53
在执行这个语句时cfg.AddAssembly("OfficeSunLightDataModule");
提示
未能找到元素“urn:nhibernate-mapping-2.0:hibernate-mapping”的架构信息。
...全文
133 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
purple_tide 2007-10-18
  • 打赏
  • 举报
回复
应该是配置文件的格式 和nhibernate组件的版本对不上\

看看文件中声明的名字空间 是否和nhibernate的一致 例如都是1.2.0
In this article I want to discuss the lazy loading mechanism provided by NHibernate. It is recommended for maximum flexibility to define all relations in your domain as lazy loadable. This is the default behavior of NHibernate since version 1.2. But this can lead to some undesired effects if querying your data. Let's discuss these effects and how to avoid them. Term Paper AND Research Paper In my previous posts I showed how to prepare your system for NHibernate and how to implement a first NHibernate base application. This post is based on those two articles. Thesis AND Dissertation AND Essay The Domain Let's first define a simple domain. It shows part of an order entry system. I keep this model as simple as possible (a real domain model would be more complex) but it contains all aspects we want to discuss in this post. Below is the class diagram of our model We have an order entity which can be placed by a customer entity. Each order can have many order line entities. Each of the three entity types is uniquely identified by a property Id (surrogate key). The Mapping Files We have to write one mapping file per entity. It is recommended that you always have one mapping per file. Don't forget to set the Build Action of each mapping file to Embedded Resource. People often tend to forget it and the subsequent errors raised by NHibernate are not always obvious. Also do not forget to give the mapping files the correct name, that is *.hbm.xml where * denotes the placeholder for the entity name. The mapping for the Order entity might be implemented as follows <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="LazyLoadEagerLoad" namespace="LazyLoadEagerLoad.Domain"> hibernate-mapping>Analogous you can implement the mappings for the Customer entity <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="LazyLoadEagerLoad" namespace="LazyLoadEagerLoad.Domain"> hibernate-mapping>and finally the mapping for the OrderLine entity. <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="LazyLoadEagerLoad" namespace="LazyLoadEagerLoad.Domain"> hibernate-mapping>

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧