views:

297

answers:

1

I tried to find tutorials/articles on using UnitOfWorkApplication in ASP.NET (not MVC). But all information I can find is about how to use it in ASP.NET MVC.

Does it mean that it is not possible to use Rhino.Commons.HttpModules.UnitOfWorkApplication in our old webform applications?

I run into the problem that I am using repository inherited from Rhino.Commons.NHRepository in ASP.NET pages. It requires to call UnitOfWork.Start() before calling functions in the repository. I'm quite lost in figuring out how to hook that into ASP.NET.

+1  A: 

Yes, it works with regular ASP.NET. Just make your GlobalApplication inherit from UnitOfWorkApplication. UnitOfWork.Start() is automatically executed when the request starts (source code).

For reference, check the wiki page.

Mauricio Scheffer
I get an error "File D:\PathOfSite\Windsor could not be found " when browsing the site after inherit from UnitOfWorkApplication. I think I need to config for Windsor? But how?
Ken Yao
you can use either xml (windsor.config) or binsor (windsor.boo) to set up windsor. See this sample binsor config: https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/SampleApplications/Exesto/Exesto.Web/Windsor.boo
Mauricio Scheffer
Thanks very much. It works!
Ken Yao