Book Image

Learning NHibernate 4

Book Image

Learning NHibernate 4

Overview of this book

Table of Contents (18 chapters)
Learning NHibernate 4
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Summary


There are multitude of different ways of retrieving data in NHibernate. These can be mainly divided into two types. First type consists of ISession.Get<T> and ISession.Load<T>, which you can use when you know the id of the entity you want to retrieve. Both of these can be the fastest ways of retrieving an entity from database. These are used by NHibernate internally. Second type of data retrieval methods in NHibernate are geared towards complex situations that go beyond loading entities by their id. HQL, Criteria API, QueryOver, and LINQ, all let you write complex queries in an intuitive way using object-oriented APIs. These let you load entities by properties other than ID or even combination of properties, join two or more entities, and so on. NHibernate does a lot of heavy lifting for you when it comes to writing complex queries, making the job of writing queries very easy. Querying capabilities of NHibernate are not limited to only complex queries. You can aggregate...