Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Learning NHibernate 4
  • Table Of Contents Toc
  • Feedback & Rating feedback
Learning NHibernate 4

Learning NHibernate 4

By : Suhas H Chatekar
3.6 (9)
close
close
Learning NHibernate 4

Learning NHibernate 4

3.6 (9)
By: Suhas H Chatekar

Overview of this book

This book targets .NET developers who have never used an ORM before, developers who have used an ORM before but are new to NHibernate, or have used NHibernate sparingly and want to learn more about NHibernate.
Table of Contents (13 chapters)
close
close
12
Index

What this book covers

Chapter 1, Introduction to NHibernate, provides a view of NHibernate from 10,000 feet above and touches upon topics such as what an ORM is and why developers should use it. New features of NHibernate 4.0 are examined in this chapter along with the basic building blocks of NHibernate.

Chapter 2, Let's Build a Simple Application, describes a problem statement and builds a very simple domain model, so that we have a set of known business requirements to refer to in the rest of the book. This chapter also covers different software and tools that we will use throughout the book.

Chapter 3, Let's Tell NHibernate About Our Database, takes a deep dive into one of the building blocks of NHibernate –– mapping. The chapter starts with a brief introduction to the different mechanisms of mapping supported by NHibernate. The rest of the chapter goes into the details of mapping classes, properties, identifiers, associations, and inheritance hierarchies. In this chapter, the domain model defined in Chapter 2, Let's Build a Simple Application, is mapped to an appropriate database schema.

Chapter 4, NHibernate Warm-up, walks through the configuration of NHibernate. The chapter starts with a discussion on the different ways of configuring NHibernate and the minimal configurations required to get it up and running. Many important, but optional, configurations that include caching, session context, batch size, and so on, are covered next. The chapter ends with a discussion on generating database creation and updating scripts using NHibernate mappings.

Chapter 5, Let's Store Some Data into the Database, in a nutshell covers the NHibernate API that saves data in database. Beyond this, this chapter covers important concepts such as transactions, flush modes, cascades, and inverse collections. This chapter explains how transitive persistence works in different scenarios. Entity equality and its implementation in the context of NHibernate is provided in this chapter.

Chapter 6, Let's Retrieve Some Data from the Database, as the name suggests, talks about retrieving data from the database using the different querying methods supported by NHibernate. The book stresses using LINQ but other methods, namely native SQL, HQL, Criteria API and QueryOver, are also introduced and covered in detail wherever required. The chapter goes into the details of important concepts such as joins, lazy loading, eager fetching, and polymorphic queries. Basic querying requirements such as sorting and ordering the results are explained in this chapter.

Chapter 7, Optimizing the Data Access Layer, talks about making the NHibernate code more efficient by making use of techniques such as batching, different fetching strategies, and avoiding "select N+1" and eager fetching.

Chapter 8, Using NHibernate in a Real-world Application, introduces some architectural principles such as onion architecture and dependency injection that will help in building a robust data access layer using NHibernate in production code. This chapter covers important concepts, such as unit of work and session per request along with their implementation in NHibernate. Repository pattern, the most commonly used pattern for abstracting the low level details of data access code, is also covered in this chapter.

Chapter 9, Advanced Data Access Patterns, begins with a discussion on the shortcomings of repository pattern. The chapter then introduces two data access patterns, namely specification pattern and query object pattern, which address the shortcomings of repository pattern.

Chapter 10, Working with Legacy Database, goes into the NHibernate features that come handy in legacy database situations –– where database schema is not ideal for the domain model at hand. The chapter talks about composite IDs, components, working with database views, stored procedures, and custom DTOs. Custom lazy loading retention is introduced, so that it can be used with DTOs when there is a chance that NHibernate's lazy loading is rendered ineffective.

Chapter 11, A Whirlwind Tour of Other NHibernate Features, talks about the features of NHibernate that are slightly advanced and are not touched upon in any of the previous chapters. Important features such as concurrency control, event system, caching, and user-defined types are covered along with practical examples of their usage.

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Learning NHibernate 4
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon