Book Image

NHibernate 3 Beginner's Guide

By : Dr. Gabriel Nicolas Schenker, Aaron Cure
Book Image

NHibernate 3 Beginner's Guide

By: Dr. Gabriel Nicolas Schenker, Aaron Cure

Overview of this book

<p>Ideally, we would want to persist the objects our application uses and produces AS IS, without having to first transform them in complex ways. NHibernate is a framework that provides us with an object-oriented access to a relational database without having to write SQL and with little or no database-specific data access code. Definitely, if you are a .NET developer, knowing more about NHibernate will simplify and reduce your efforts in developing .Net applications.<em>NHibernate 3 Beginner's Guide</em> introduces Nhibernate with step-by-step examples, and is the easiest way to learn about bridging the gap between object-oriented .NET applications and the relational database that stores the application's data. It is a beginner's guide to NHibernate that starts from scratch. Successive chapters build upon earlier concepts, while the sample code presents various ways to accomplish typical data access tasks.</p> <p><em>NHibernate 3 Beginner's Guide</em> examines all of the topics required to get a functional data access layer implemented while writing the least amount of code possible, presenting options along the way to handle particular edge cases or situations as they arise. The book begins with an introduction to NHIbernate 3 and then moves on to creating the development environment. Then it teaches you how to create a model, define a database schema, and map the model to the database then covers sessions and transactions. This is succeeded by testing, profiling, and configuration, validation of data and writing queries. Finally, we wrap up with notes on the common pitfalls that you should avoid.</p> <p>Once you complete reading the book, you will have gained the skills and knowledge to incorporate NHibernate into your own applications.</p>
Table of Contents (19 chapters)
NHibernate 3 Beginner's Guide
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – Adding NHibernate Profiler support


In this exercise, we want to download, install, and use NHibernate Profiler to monitor the database communication caused by our unit test.

  1. Download NHibernate Profiler from http://www.nhprof.com/Download.

  2. Unpack the ZIP file (at the time of writing NHibernate.Profiler-Build-796.zip) into a new folder (for example, C:\tools\NHProfiler).

  3. Navigate to the installation folder and run NHibernate Profiler by double-clicking on NHProf.exe. You will be presented with a dialog, as shown in the following screenshot:

  4. Request a trial license. The license will be sent to you by e-mail.

  5. Create a new XML file in the application folder (for example, MyLicense.xml) and copy the license key from the e-mail and paste it into the XML file just created.

  6. Run NHibernate Profiler again and click on Browse for Your License. Locate and select the MyLicense.xml file in the NHibernate Profiler application folder.

  7. In the NHibernate Profiler application folder, locate the...