NHibernate is an open source object-relational mapper, or simply put, a way to retrieve data from your database into standard .NET objects. Quite often we spend hours designing the database, only to go back and re-design a mechanism to access that data and then optimize that mechanism. This book will save you time on your project, providing all the information along with concrete examples about the use and optimization of NHibernate.
This book is an approachable, detailed introduction to the NHibernate object-relational mapper and how to integrate it with your .NET projects. If you're tired of writing stored procedures or maintaining inline SQL, this is the book for you.
Connecting to a database to retrieve data is a major part of nearly every project, from websites to desktop applications to distributed applications. Using the techniques presented in this book, you can access data in your own database with little or no code.
This book covers the use of NHibernate from a first glance at retrieving data and developing access layers to more advanced topics such as optimization and Security and Membership providers. It will show you how to connect to multiple databases and speed up your web applications using strong caching tools. We also discuss the use of third-party tools for code generation and other tricks to make your development smoother, quicker, and more effective.
This easy-to-follow guide will show you how to connect the NHibernate object-relational mapper to your projects to create a rich, efficient, object-oriented data access layer with little or no additional work
What you will learn from this book
Use NHibernate to retrieve and store data in your database
Develop an efficient, robust data access layer with little or no code
Design or modify your database for high performance
Connect to multiple databases or database backends with simple code
Implement base classes to provide basic functionality for all database objects
Improve the performance of your data retrieval methods with proven open source technology
Make web applications faster using strong caching strategies such as memcached
Simplify data storage and display using built-in .NET data controls with NHibernate
Using NHibernate to control application security using Membership and Role providers and .NET security controls
This is a beginner's guide to NHibernate that starts from ground zero. Successive chapters build upon earlier concepts, while the sample code presents various ways to accomplish typical data access tasks. Within a few chapters you have a running application using NHibernate to retrieve and store data.
We examine all of the topics required to get a functional data access layer implemented by writing the least amount of code possible, presenting options along the way to handle particular edge cases or situations as they arise.
When you have completed the various exercises you will have running data-bound desktop and web applications, as well as an understanding of how to implement NHibernate in your own applications.
Who this book is written 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.