NHibernate 2

NHibernate 2 Beginner's Guide

Download

What this book covers

Chapter 1, First Look, discusses what an object-relational mapper is, what NHibernate is, and the features it provides us.

Chapter 2, Database Layout and Design, discusses how your database is constructed, how the data is related, and how to optimize it for the best performance using NHibernate.

Chapter 3, A Touch of Class, explains how creating classes to represent your data makes it easy for you to work with the data and allows you to branch from the design of the database, if need be.

Chapter 4, Data Cartography, deals with the actual interface to the database with NHibernate, either using XML mapping files, Fluent NHibernate, or no mapping at all. We also talk about lazy loading, using a fieldnames structure to help avoid typos, and generating the database from our mapping files or classes.

Chapter 5, The Session Procession, teaches you how to create NHibernate sessions, which use database sessions to retrieve and store data into the database.

Chapter 6, I'm a Logger, teaches you how to use the log4net logging framework for creating our own logs and tap into the information provided by NHibernate (including SQL statements) to monitor and troubleshoot our application.

Chapter 7, Configuration, explains how to configure our application so, we are ready to retrieve and store data into our database. Additional configuration options are discussed, as well as optional configuration properties for particular situations.

Chapter 8, Writing Queries, discusses using NHibernate to actually retrieve data, to include individual records and collections of records. We talk about filtering records and using the fieldnames structure we created earlier to speed up our development. We also talk about adding parameters to make paging and sorting work in data-bound controls.

Chapter 9, Binding Data, explains how to use the data methods we created earlier to build a web application that uses our data access layer, the ObjectDataSource, and other data controls to retrieve, display, and even insert/update database data.

Chapter 10, NET Security Providers, presents information about controlling access to and restricting the usage of data within a .NET web application. We discuss the use of custom membership and role providers with NHibernate to control access to information.

Chapter 11, It's a Generation Thing, discusses how to use code generation techniques such as CodeSmith, NHib-Gen, and MyGeneration to automatically generate our data access layer to get us up and running that much quicker.

Chapter 12, Odds and Ends, discusses some advanced topics such as the Burrow session management framework and the NHibernate SchemaExport tool.

What you need for this book 
To successfully complete the examples in this book, you will need a copy of either Visual Studio 2008 or 2010. You can use any version as long as it includes the web application projects. This could be either a Visual Web Developer Express version or any full version such as Professional. In addition to Visual Studio, you will also need a SQL database server. The examples are generated using SQL Server Express 2008 and SQL Server Management Studio (SSMS) Express. You will also need to download the NHibernate binary files from sourceforge.net.

Who this book is for 
This book is for new and seasoned developers of .NET web or desktop applications who want a better way to access database data. It is a basic introduction to NHibernate, with enough information to get a solid foundation in using NHibernate. Some advanced concepts are presented where appropriate to enhance functionality or in situations where they are commonly used.
Share This