简体   繁体   English

nhibernate nuget - 找不到架构

[英]nhibernate nuget - schema not found

I started a asp.net mvc Project and I am trying to use nibernate for db Access. 我启动了一个asp.net mvc项目,我正在尝试使用nibernate进行db Access。

I get the following warings in visual studio: 我在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'. 

My Web.conf: 我的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>
...

I installed nhibernate via nuget. 我通过nuget安装了nhibernate。

Any ideas? 有任何想法吗? Thanks in advance. 提前致谢。

Usually you can simply ignore that. 通常你可以简单地忽略它。

But if you want, you can add the schema to your xml validation in visual studio. 但是如果需要,可以在Visual Studio中将模式添加到xml验证中。 XML Menu > Schemas > Add XML菜单>架构>添加

Pick nhibernate-configuration.xsd from your packages folder 从您的packages文件夹中选择nhibernate-configuration.xsd

packages\\NHibernate\\lib\\<.NetVersion> 包\\ NHibernate的\\ lib中\\ <。NetVersion>

Now VS should be able to validate your xml (web.config) correctly. 现在VS应该能够正确验证你的xml(web.config)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM