Simple NHibernate Study Notes

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.