NHibernate Is An Object
NHibernate Is An Object
NET platform: it
provides a framework for mapping an object-oriented domain model to a traditional relational
database. Its purpose is to relieve the developer from a significant portion of relational data
persistence-related programming tasks.
NHibernate is free as open source software that is distributed under the GNU Lesser General
Public License.
A partial implementation of a LINQ provider is available for 2.1. A new LINQ provider using
the AST parser built for NHibernate's HQL (Hibernate Query Language) engine is in
development for version 3.0 of NHibernate. It is currently available for preview in NHibernate
3.0.0.Alpha2 (at 2010-08-15)
Feature Summary
NHibernate's primary feature is mapping from .NET classes to database tables (and from CLR
data types to SQL data types). NHibernate also provides data query and retrieval facilities.
NHibernate generates the SQL commands and relieves the developer from manual data set
handling and object conversion, keeping the application portable to most SQL databases, with
database portability delivered at very little performance overhead.
NHibernate provides transparent persistence for Plain Old CLR Objects (POCOs). The only
strict requirement for a persistent class is a no-argument constructor, which does not have to be
public. (Proper behavior in some applications also requires special attention to the Equals() and
GetHashCode() methods.[1])
* Support for fine-grained object models - a rich variety of mappings for collections and
dependent objects
* No build-time bytecode enhancement - there's no extra code generation or bytecode
processing steps in your build procedure
* The query options - NHibernate addresses both sides of the problem; not only how to get
objects into the database, but also how to get them out again
* Custom SQL - specify the exact SQL that NHibernate should use to persist your objects.
Stored procedures are supported on Microsoft SQL Server.
* Visual Studio Friendly - Easily map regular C# or VB.NET object models designed in Visual
Studio. No special base classes or attributes needed. Fully supports inheritance, components and
enums.
* Fast Development Cycle - Generates database tables from your domain models. Supports all
popular relational databases. Supports the most complex legacy scenarios.
* Tons of Plugins & Tools - Full Text Search. Cluster-scoped caching with Microsoft Velocity
& Memcached. Business validation rules. ReSharper plugin. Castle Active Record. S#arp
Architecture. And many more...
* Free/open source - NHibernate is licensed under the LGPL (Lesser GNU Public License)
NHibernate is an Object-relational mapping (ORM) solution for the Microsoft .NET platform. It
is licensed under the GNU Lesser General Public License. It is a port of the popular Java O/R
mapper Hibernate to .NET. Version 1.0 mirrors the feature set of Hibernate 2.1, adding a number
of features from Hibernate 3. NHibernate 1.2.0, released May of 2007, introduces many more
features from Hibernate 3 and support for .NET 2.0, stored procedures, generics and nullable
types.
All classes and collections with 1.2 are now loaded lazily by default. You may need
to change lazy="false", or make methods be virtual.
Use .Net 2.0 Generics for all collection interfaces (You no longer have to use the
NHibernate.Generics compatability library).
Support Batching for SQL Server - huge perforamance increase in some scenarios.
Support Stored Procedures.
Support named connection strings.
Support SQL Server 2005 and SQL Server 2005 Everywhere dialects.
Support Parametrized types and User Collection Types.
Support projections in criteria queries, i.e. CreateCriteria(typeof(T)).Count(), and
CreateCriteria(typeof(T)).Max(...), etc.
New IL-based reflection optimizer - another big performance boost.
Use SetProjection(Projections.Count("ID")) instead of IQuery's Select count(*).
New DetachedCriteria
New GetCurrentSession method of SessionFactory:
SessionFactory.GetCurrentSession()
Referal Links
http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx