When using Nhibernet in your project, be sure to set the configuration file. XML compilation to an embedded resource, or you will get an error when you run the project.
The following is the configuration of the Hibernate.cfg.xml, which is used in the configuration of the Mysql database
<?xml version= "1.0" encoding= "Utf-8"? >Where ConnectionString is the name of the database connection string, defined in Web. config in project startup, is defined as follows:
<connectionStrings> <!-- Database connection string The Name property value cannot be changed arbitrarily, and the database connection character ConnectionString property can be modified to fit the actual needs- <add name= "ConnectionString" connectionstring= "server=;d atabase=;uid=;p wd=;" Providername= " MySql.Data.MySqlClient "/> </connectionStrings>
The database object mapping file and the corresponding mapping file can be generated with a dedicated build tool, here we recommend a good build tool: Nhibernate mapping Genertor
: Link: http://pan.baidu.com/s/1gd3WpKf Password: FGWO
ORM nhibernate Framework configuration in the project