public
Description:
Homepage:
Clone URL: git://github.com/machine/machine.uow.git
Jacob Lewallen (author)
Tue Dec 01 14:33:30 -0800 2009
commit  ec4a392d52ad819a96285402dfaf5f2959c6631b
tree    29e3877ed23c385b2117cf4461bc7f4df2ca0e2c
parent  4dc77a60bc204b6a18a22a385ad9104e8fade9c4
name age message
file .gitignore Thu Apr 02 12:05:47 -0700 2009 Not storing specification reports in VC. [jlewallen]
directory Libraries/ Sun Apr 12 23:32:20 -0700 2009 Fixing references [aaronjensen]
file Partstore.config Thu Oct 23 11:40:45 -0700 2008 Updated Partstore configuration/state. [jlewallen]
file README.markdown Fri Oct 24 08:52:45 -0700 2008 README.markdown work. Just some simple stuff. [jlewallen]
directory Source/ Tue Dec 01 14:33:30 -0800 2009 Nuking excessive logging. [Jacob Lewallen]
file rakefile Thu Apr 02 10:21:34 -0700 2009 Major change, completely new school now. Total... [jlewallen]
README.markdown

Machine.UoW

Example

Setting up and configurating for use with NHibernate under ASP.NET:

ISessionFactory sessionFactory = ?;
IUnitOfWorkManagement unitOfWorkManagement = new UnitOfWorkManagement();
unitOfWorkManagement.AddEvents(new NHibernateUoWEvents(sessionFactory));
IUnitOfWorkFactory factory = new UnitOfWorkFactory(unitOfWorkManagement);
UoW.Provider = new HttpContextUnitOfWorkProvider(factory);

From then on, it's a matter of:

using (IUnitOfWork uow = UoW.Start())
{
    uow.Session().CreateQuery("FROM People").List<SessionType>();
}

In this case Session() is an extension method provided by the Machine.UoW.NHibernate assembly. Machine.UoW has no dependency on NH.

Settings can be passed to the underlying UoW plugins:

using (IUnitOfWork uow = UoW.Start(new NHibernateSessionSettings(IsolationLevel, FlushMode)))
{
    uow.Session().CreateQuery("FROM People").List<SessionType>();
}

Of course you can clean this up, etc... Machine.UoW.NH finds the settings and uses them.