Learning NHibernate 4

Explore the full potential of NHibernate to build robust data access code
Preview in Mapt

Learning NHibernate 4

Suhas Chatekar

1 customer reviews
Explore the full potential of NHibernate to build robust data access code

Quick links: > What will you learn?> Table of content> Product reviews

Mapt Subscription
FREE
$29.99/m after trial
eBook
$28.00
RRP $39.99
Save 29%
Print + eBook
$49.99
RRP $49.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$28.00
$49.99
$29.99 p/m after trial
RRP $39.99
RRP $49.99
Subscription
eBook
Print + eBook
Start 14 Day Trial

Frequently bought together


Learning NHibernate 4 Book Cover
Learning NHibernate 4
$ 39.99
$ 28.00
NHibernate 4.x Cookbook - Second Edition Book Cover
NHibernate 4.x Cookbook - Second Edition
$ 39.99
$ 28.00
Buy 2 for $35.00
Save $44.98
Add to Cart

Book Details

ISBN 139781784393564
Paperback402 pages

Book Description

Connecting the object-oriented world of .NET to the relational world of databases has always been fiddly but with the onset of ORMs such as NHibernate, developers have finally got some relief in this area.

You will begin with a bird's eye view of NHibernate, touching upon its core concepts. You will define domain model and map it with database schema using different techniques. You will then look into multiple ways of storing domain entities in a database and learn important concepts such as transitive persistence, transactions and unit of work. This will be followed by retrieving data from database. Next, you will optimize your code, explore concepts such as the onion architecture, and learn where NHibernate fits best in an application's architecture. After introducing a well-known repository pattern into our application, you will learn to deal with legacy databases. We will conclude with infrequently used features such as stateless sessions, the second level cache, concurrency, and so on, which might come handy.

Table of Contents

Chapter 1: Introduction to NHibernate
What is ORM?
What is NHibernate?
What is new in NHibernate 4.0?
NHibernate for users of Entity Framework
Is using ORM a bad idea?
Building blocks of NHibernate
Summary
Chapter 2: Let's Build a Simple Application
Explaining the approach used in learning NHibernate
The problem statement
The development setup
The domain model
Adding some code
Summary
Chapter 3: Let's Tell NHibernate About Our Database
Important NHibernate terminology
Mapping the prerequisites
Different mechanisms to write the mappings
XML mappings for the Employee class
Identifier generation
Mapping associations
Mapping inheritance
Mapping components
Mapping by code
Fluent mapping a.k.a. Fluent NHibernate
Choosing the right mapping method
Summary
Chapter 4: NHibernate Warm-up
Warming up NHibernate succinctly
The NHibernate session architecture
XML configuration
Programmatic configuration
Loquacious configuration
Fluent configuration
Configuration options
Generating the database scripts from mappings
Summary
Chapter 5: Let's Store Some Data into the Database
Entity states
Transactions and unit of work
Saving entities
Transitive persistence using cascade styles
Transitive persistence/cascading in action
Bidirectional associations and ownership
Order of operations
Entity equality
The architecture diagram
Summary
Chapter 6: Let's Retrieve Some Data from the Database
Querying the workflow
Different querying methods
Joins
Lazy loading
Eager fetching
Pagination and ordering of results
Retrieving entities by identifiers
Polymorphic queries
Summary
Chapter 7: Optimizing the Data Access Layer
Baseline and optimize
Organization of the chapter
Batching
Fetching strategies

Avoiding the select N+1 problem
Avoiding eager fetching
Using extra-lazy for lazy collections
Summary
Chapter 8: Using NHibernate in a Real-world Application
What kind of application are we building?
Architectural principles we will follow
Feature 1 – onboarding an employee
Unit of work
Feature 2 – updating the details of an employee
Feature 3 – searching employees
Summary
Chapter 9: Advanced Data Access Patterns
Problems with the repository pattern
Specification pattern
Query object pattern
Summary
Chapter 10: Working with Legacy Database
Composite IDs
Components
Join-mapping to load data from multiple tables
Working with database views
Using subselect instead of views
Working with stored procedures
Using custom DTOs
Summary
Chapter 11: A Whirlwind Tour of Other NHibernate Features
Concurrency control
Event system
Caching
Stateless sessions
User-defined types
Summary

What You Will Learn

  • Map domain entities to a database schema using the different mapping mechanisms available
  • Configure NHibernate through XML configuration
  • Save, update, and delete entities in the database and query data from a database using different querying methods
  • Optimize database operations for speed and memory consumption
  • Use NHibernate in real-life software projects
  • Get to know about data access patterns such as repository, specification, and query object
  • Use NHibernate with legacy databases

Authors

Table of Contents

Chapter 1: Introduction to NHibernate
What is ORM?
What is NHibernate?
What is new in NHibernate 4.0?
NHibernate for users of Entity Framework
Is using ORM a bad idea?
Building blocks of NHibernate
Summary
Chapter 2: Let's Build a Simple Application
Explaining the approach used in learning NHibernate
The problem statement
The development setup
The domain model
Adding some code
Summary
Chapter 3: Let's Tell NHibernate About Our Database
Important NHibernate terminology
Mapping the prerequisites
Different mechanisms to write the mappings
XML mappings for the Employee class
Identifier generation
Mapping associations
Mapping inheritance
Mapping components
Mapping by code
Fluent mapping a.k.a. Fluent NHibernate
Choosing the right mapping method
Summary
Chapter 4: NHibernate Warm-up
Warming up NHibernate succinctly
The NHibernate session architecture
XML configuration
Programmatic configuration
Loquacious configuration
Fluent configuration
Configuration options
Generating the database scripts from mappings
Summary
Chapter 5: Let's Store Some Data into the Database
Entity states
Transactions and unit of work
Saving entities
Transitive persistence using cascade styles
Transitive persistence/cascading in action
Bidirectional associations and ownership
Order of operations
Entity equality
The architecture diagram
Summary
Chapter 6: Let's Retrieve Some Data from the Database
Querying the workflow
Different querying methods
Joins
Lazy loading
Eager fetching
Pagination and ordering of results
Retrieving entities by identifiers
Polymorphic queries
Summary
Chapter 7: Optimizing the Data Access Layer
Baseline and optimize
Organization of the chapter
Batching
Fetching strategies

Avoiding the select N+1 problem
Avoiding eager fetching
Using extra-lazy for lazy collections
Summary
Chapter 8: Using NHibernate in a Real-world Application
What kind of application are we building?
Architectural principles we will follow
Feature 1 – onboarding an employee
Unit of work
Feature 2 – updating the details of an employee
Feature 3 – searching employees
Summary
Chapter 9: Advanced Data Access Patterns
Problems with the repository pattern
Specification pattern
Query object pattern
Summary
Chapter 10: Working with Legacy Database
Composite IDs
Components
Join-mapping to load data from multiple tables
Working with database views
Using subselect instead of views
Working with stored procedures
Using custom DTOs
Summary
Chapter 11: A Whirlwind Tour of Other NHibernate Features
Concurrency control
Event system
Caching
Stateless sessions
User-defined types
Summary

Book Details

ISBN 139781784393564
Paperback402 pages
Read More
From 1 reviews

Read More Reviews

Recommended for You

NHibernate 4.x Cookbook - Second Edition Book Cover
NHibernate 4.x Cookbook - Second Edition
$ 39.99
$ 28.00
NHibernate 3.0 Cookbook Book Cover
NHibernate 3.0 Cookbook
$ 26.99
$ 18.90
.NET Design Patterns Book Cover
.NET Design Patterns
$ 31.99
$ 22.40
Node.js Design Patterns - Second Edition Book Cover
Node.js Design Patterns - Second Edition
$ 39.99
$ 28.00
Automating Microsoft Azure with PowerShell Book Cover
Automating Microsoft Azure with PowerShell
$ 23.99
$ 16.80
Excel Programming with VBA Starter Book Cover
Excel Programming with VBA Starter
$ 9.99
$ 7.00