资 源 简 介
Repository with NHibernate
Introduction
This project serves as an example on how to implement the Repository pattern in .NET using NHibernate (with FluentNHibernate). There is no official definition of the Repository pattern and many different implementations exist on the web. However, most sources will agree that the the Repository pattern is effectively the Factory pattern with the 4 basic CRUD operations (plus a LINQ-compatible GetAll()), like so:
public interface IRepository{ T Get(object id); void Save(T value); void Update(T value); void Delete(T value); IList GetAll();}
Description
The beauty of Repository is in its simplicity. Grabbing an object from the database only requires two lines of code:
```
IRepository monkeyRepo = new NHibernateRepository();
Monkey m