2. Configure nhib.pdf
[Most of the text in this article is reproduced on multiple networks for learning purposes only. Please contact: binglingshui (a) gmail.com.]
2.1 configuration file description
ORM (object relational mapping, object/link ing)It is used to map between relational databases and objects. In this way, we do not need to deal with complex SQL statements when operating the database, you only need to operate on an object as usual.
Object Relational ing, the core of which is to complete two functions: the ing rules between objects and relational databases, and the mutual conversion between the two.
In addition to these two basic functions, General o/R mapping products will also add some additional features and functions to enhance product functions, it provides more convenience and performance improvement for software development. Some common functions, such as caching.
There are some typical o/R Mapping frameworks available for reference and use. The well-known ones are entity beans, JDO, and hibernate in ejbs. These solutions are based on Java. In Microsoft. NET
There are few options available, including nhib.pdf.
......
2.2 configuration file example in WEB Project
Add the Nhibernate sections configuration Node
Code
< Configsections >
<! -- Nhib1_section -->
< Section Name = "Hibernate-configuration" Type = "Nhibernate. cfg. configurationsectionhandler, nhibler" />
</ Configsections >
ConfigureDatabase ConnectionDetails
Nhib1_configuration
<! -- Nhib1_configuration -->
< Hibernate-Configuration Xmlns = "Urn: nhibernate-configuration-2.2" >
< Session-factory >
< Property Name = "Connection. provider" > Nhib.pdf. Connection. driverconnectionprovider </ Property >
< Property Name = "Dialect" > Nhib.pdf. dialect. mssql2005dialect </ Property >
< Property Name = "Connection. driver_class" > Nhib.pdf. Driver. sqlclientdriver </ Property >
< Property Name = "Connection. connection_string" >
Data Source =. \ sqlexpress; Integrated Security = sspi; attachdbfilename = | datadirectory | \ dinnertime. MDF; user instance = true
</ Property >
< Mapping Assembly = "Dinnertime. Model" />
</ Session-factory >
</ Hibernate-Configuration >
2.2 configuration file example