将 IntelliSense 添加到映射文件
在本章中,我们将向我们的 NHibernate 映射文件 (*.hbm.xml 文件) 添加 IntelliSense。正如您在映射域 Student 类时所观察到的,目前我们没有可用的 IntelliSense。拥有 XML 架构 非常有用。因此,在本章中,您将了解如何在 Visual Studio 中为这些 NHibernate XML 文件添加 IntelliSense。
打开映射文件,您将看到 XML 菜单选项出现在主菜单中。

选择 XML → Schemas… 菜单选项,它将显示 XML Schemas 对话框。

选择对话框右上角的 Add… 按钮,打开文件对话框。现在转到 packages 文件夹,它位于项目的解决方案文件夹中,您将看到项目中包含的不同包。

现在,双击 NHibernate.4.*** 文件夹,您将看到定义 NHibernate 配置和映射的两个架构 (*.xsd) 文件或 XML 架构定义文件。

选择这两个架构文件并单击打开按钮。

您可以看到 NHibernate 架构已添加到 XML 中Schemas 对话框。单击 OK 按钮。现在,让我们开始一个新的属性标签,您将看到我们在这里拥有完整的 IntelliSense。

IntelliSense 现在可供您使用,这在对象关系映射期间节省了大量时间。