我尝试使用我从trunk构建的NHibernate.Search并与NHibernate 2.0.1一起使用。当我将一些NHibernate.Search属性配置添加到配置文件中时:
<property name="hibernate.search.default.directory_provider">NHibernate.Search.Storage.RAMDirectoryProvider, NHibernate.Search</property>
<property name="hibernate.search.default.indexBase">~\index\</property>
我收到一个无效的System.Xml.Schema.XmlSchemaException:Enumeration约束失败。当我使用时:
var configuration = new Configuration().Configure();
那么我该如何解决这个问题呢?
答案 0 :(得分:3)
确保您定义的NHibernate.Search属性包含在nhs-configuration块中,而不是标准的NHibernate配置块中。 您的web.config应如下所示:
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
<section name="nhs-configuration" type="NHibernate.Search.Cfg.ConfigurationSectionHandler, NHibernate.Search" />
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<!-- nhibernate configuration block -->
</hibernate-configuration>
<nhs-configuration xmlns='urn:nhs-configuration-1.0'>
<search-factory>
<property name='hibernate.search.default.directory_provider'>NHibernate.Search.Store.FSDirectoryProvider, NHibernate.Search</property>
<property name='hibernate.search.default.indexBase'>...</property>
</search-factory>
</nhs-configuration>