1. Quickstart with IIS and Microsoft SQL Server
1.1 Getting started
1.1.1 Configuration Files
- ISessionFactory - NHibernate concept of a single datastrore, multiple databased (Multiple XML for multiple database). Mapping assembly also set in the config file.
1.2 Persistence class (POCO - Plain old CLR objects)
1.3 Mapping the POCO
- Must have the unique id. (UUID only for testing. surragate keys generated by DB should be prefered)
- NHibernate use unique id to identify value.
1.4 Starting
- ISession - it is the persistance manager interface (Unit Of Work) that use to store and retrieve POCO from DB.
- Get ISession from the ISessionFactory
1.4.1 ISessionFactory
- 1 to 1 relation with DB and config files
- 1 xml config giles and usually built once at startup
- Singleton
- It is Thread safe - many threads can access concurrent
- ISession is a non-threadsafe - represent a single unit of work with Database.
-Several method for retrieving data
i) HQL
ii)Query by criteria API
iii) IDbCommands
No comments:
Post a Comment