1. New Project
Business: Logic Classes
Data: Database operation and NHibernate helper classes
Domain: Data entities and database mapping files
2. Download NHibernate using NuGet
Database configuration file under Folder Packages\nhibernate.4.1.1.4000\configurationtemplates
The SQL Server database is used here, so copy MSSQL.cfg.xml to the NHibernate project, modify the file name: Hibernate.cfg.xml, and modify the connection configuration for the database. <mapping assembly= "Domain" > Specify entity class mapping file.
Note Modify the properties of the XML to always copy or to update the replication more.
The new entities and Mappings folders in domain hold entity classes and mapping files, respectively. Entity classes use automatic attributes and are virtual, noting that the mapping file for an entity class is to be set to an embedded resource.
New Nhibernatehelper Helper Class
To add a data access layer:
To add a business logic layer:
Project Overall Document:
Call
: http://pan.baidu.com/s/1nuCRhC9
The construction of NHibernate