NHibernate is the ORM framework under the. NET platform that interacts with the project's database as it does with ADO.
1. First to use the NHibernate framework will have a third-party DLL library to support, attached Baidu Cloud: (Link: http://pan.baidu.com/s/1dD2KRvz password: 50FB)
2. Create a new Class library project to introduce DLL files in the NHibernate library:
Create a new question class People.cs:
Note that each property here is added the virtual keyword
The mapping file file name of the entity class is then configured to be named People.hbm.xml, which changes the build action in the attribute to the embedded Resource
3. Create a new test project
In the bin directory of the test project, configure a nhibernate with the database and a global mapping file for the current class to be named fixed: Hibernate.cfg.xml
It is important to note that you should be aware of the version of the database you are using when configuring the Dialect property
4. Finally the call (note here is the NHibernate query language hql, this test program for the console application)
Simple NHibernate Study Notes