nhibernate nuget - 找不到架构

时间:2013-12-20 14:25:53

标签: c# nhibernate

我启动了一个asp.net mvc项目,我正在尝试使用nibernate进行db Access。

我在visual studio中得到以下警告:

Could not find schema information for the element 'urn:nhibernate-configuration-2.2:hibernate-configuration'.   
Could not find schema information for the element 'urn:nhibernate-configuration-2.2:session-factory'.
Could not find schema information for the element 'urn:nhibernate-configuration-2.2:property'.  
Could not find schema information for the attribute 'name'. 
Could not find schema information for the element 'urn:nhibernate-configuration-2.2:property'.  
Could not find schema information for the attribute 'name'. 
Could not find schema information for the element 'urn:nhibernate-configuration-2.2:property'.  
Could not find schema information for the attribute 'name'. 

我的Web.conf:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
  </configSections>
....
  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
      <property name="dialect">NHibernate.Dialect.MySQLDialect</property>
      <property name="connection.driver_class">NHibernate.Driver.MySqlDataDriver</property>
      <property name="connection.connection_string_name">MainDb</property>
    </session-factory>
  </hibernate-configuration>
...

我通过nuget安装了nhibernate。

有什么想法吗? 提前谢谢。

1 个答案:

答案 0 :(得分:4)

通常你可以忽略它。

但是如果需要,可以在Visual Studio中将模式添加到xml验证中。 XML菜单&gt;架构&gt;添加

从您的包文件夹中选择nhibernate-configuration.xsd

  

包\ NHibernate的\ lib中\&LT; .NetVersion&GT;

现在VS应该能够正确验证你的xml(web.config)。