NHibernate: ORM for .Net

NHibernate website states [1]: “NHibernate is a mature, open source object-relational mapper for the .NET framework. It’s actively developed , fully featured and used in thousands of successful projects.”

I found a demo project by Dario Quintana [4] and updated it, combining it with Getting Started  Guide – Your first NHibernate based application [2].

The demo app on the Getting Started  Guide – Your first NHibernate based application [2] is a little bit buggy, but combining it with Dario Quintana demo I got to understand this NHibernate stuff.

Sample project with full source code here:

https://docs.google.com/open?id=0B7gHrdOYQf9yNmRzeHNjU201eFk

Some code example:

public class Employee 
{ 
public virtual int Id { get; private set; } 
public virtual string FirstName { get; set; } 
public virtual string LastName { get; set; } 
public virtual Store Store { get; set; } 
}

You can notice the following:

  1. Firstly, the Id property has a private setter, this is because it’s only NHibernate that should be setting the value of that Id.
  2. Secondly, all the properties are marked virtual; this is because NHibernate creates “proxies” of your entities at run time to allow for lazy loading, and for it to do that it needs to be able to override the properties.

References:

NHibernate [1]
Your first NHibernate based application [2]
Tutorial de NHibernate – Primeros pasos [3] by Dario Quintana (source code here) [4]
Domain Driven Design by Eric Evans [5]
Lazy Load
Using NHibernate with Visual Studio .NET
Fluent NHibernate
Fluent NHibernate in a Nutshell
fluent-nhibernate / src / Examples.FirstProject / Program.cs
Auto mapping
RavenDB vs MSSQL
Convention over configuration
The Data Driven Conspiracy
An Irrational Love of the Relational
Codd’s 12 rules
Domain-driven design
db4objects
C# Domain-Driven Design sample application
Domain Driven Design: Learning
Domain Driven Design Quickly: free E-Book
NHibernate Best Practices with ASP.NET, 1.2nd Ed.
An Overview of Unit Testing using Visual Studio Team System
Using NUnit in Visual Studio 2010

One response to this post.

  1. Entra a nuestra mejor sección y no te arrepentirás😉

    Responder

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

A %d blogueros les gusta esto: