You are previewing Working with NHibernate 3.0.
O'Reilly logo
Working with NHibernate 3.0

Book Description

This book provides examples using the IQuery, ICriteria, QueryOver, and LINQ to NHibernate API's within the context of an example Guitar Store inventory program. The reader is walked through the creation of a Microsoft SQL Server 2008 database, the creation of a Visual Studio 2010 solution consisting of 3 projects (a Window Presentation Foundation (WPF), a Console Application, and a Class Library). Each one utilizes the .NET 4.0 framework. Then the reader is walked through the steps required to configure and use the many features available contained within NHibernate 3.2. Further instructions and examples exist for the insertion of parent/child relationships, Session management, entity states (transient, persistent and detached), deletion, caching, and batching.

The last chapter utilizes ASP.NET MVC 3 and jqGrid for the creation of an internet program for viewing the guitar inventory using NHibernate and the session per web request model.

Table of Contents

  1. Cover Page
  2. Title Page
  3. Copyright
  4. ABOUT THE AUTHOR
  5. CONTENTS
  6. 1: Getting Started with NHibernate 3
    1. WHAT IS AN ORM?
    2. CREATING A SAMPLE PROJECT: THE GUITARSTORE
    3. CONFIGURING NHIBERNATE
    4. CONFIGURING THE GUITARSTORE WPF PROGRAM
    5. UNDERSTANDING LAZY LOADING
    6. CONFIGURING LOGGING USING LOG4NET
    7. SERIALIZING STARTUP
    8. INTERCEPTORS AND EVENTS
    9. SUMMARY
  7. 2: Using HQL
    1. INTRODUCTION
    2. WORKING WITH CREATEQUERY()
    3. IMPLEMENTING CREATEMULTIQUERY()
    4. UNDERSTANDING GETNAMEDQUERY()
    5. UNDERSTANDING DETACHEDQUERY
    6. WORKING WITH DETACHEDNAMEDQUERY
    7. UNDERSTANDING FUTURES
    8. SUMMARY
  8. 3: Using ICriteria
    1. INTRODUCTION
    2. WORKING WITH CREATECRITERIA
    3. IMPLEMENTING CREATEMULTICRITERIA
    4. UNDERSTANDING DETACHEDCRITERIA
    5. WORKING WITH QUERYOVER
    6. USING LAMBDA EXPRESSIONS
    7. UNDERSTANDING FUTURES
    8. USING FETCHMODE
    9. IMPLEMENTING AGGREGATE DATABASE FUNCTIONS
    10. UNDERSTANDING RESTRICTIONS AND EXPRESSIONS
    11. WORKING WITH DATA TRANSFER OBJECTS
    12. SUMMARY
  9. 4: Using LINQ to NHibernate
    1. INTRODUCTION
    2. WORKING WITH LINQ TO NHIBERNATE
    3. IMPLEMENTING PAGING
    4. UNDERSTANDING LINQ TO NHIBERNATE WITH LAMBDA EXPRESSIONS
    5. UNDERSTANDING AGGREGATE DATABASE FUNCTIONS
    6. SUMMARY
  10. 5: Managing State and Saving Data
    1. INTRODUCTION
    2. UNDERSTANDING CONCURRENCY
    3. CREATING AN IUSERTYPE
    4. INSERTING DATA
    5. UNDERSTANDING NHIBERNATE CACHING
    6. UNDERSTANDING EVICT(), MERGE(), AND PERSIST()
    7. EXECUTING BATCH PROCESSES
    8. SUMMARY
  11. 6: Using NHibernate with an ASP.NET MVC 3 Application
    1. INSTALLING ASP.NET MVC 3
    2. ADDING AN ASP.NET MVC 3 PROJECT TO THE GUITARSTORE SOLUTION
    3. CONFIGURING NHIBERNATE
    4. CONFIGURING THE ASP.NET MVC PROGRAM TO USE A SESSION-PER-WEB-REQUEST
    5. CONFIGURING THE VIEW AND CONTROLLER
    6. SUMMARY
  12. INDEX