Logo

NHibernate

The object-relational mapper for .NET

Burrow

This page is converted from the old nhforge.org Wiki. First published by: kailuowang on 09-07-2008, Last revision by: Chris Missal on 12-16-2009

Table of Contents

FAQ

  • What is NHibernate.Burrow?
    Burrow is a light weight middleware developed to support .Net applications using NHibernate (maybe also referred as NH in this article) as ORM framework. Using Asp.net with NHibernate could be a challenge because of the fact that NHibernate is a stateful environment while Asp.net is a stateless framework. Burrow can help solve this conflict by providing advanced and smart session/transaction management and other facilitates.
  • What's the major benefits offered by NHibernate.Burrow?
    • Burrow Conversation with which you can easily write business transaction
    • GenericDAO with which ISession can be seldom touched most of the time
    • Stateful field attributes with which marked fields of Asp.net UserControl and Page will be stateful over multiple http requests. It helps UserControls or Pages remember entity without causing lazy load exception.
    • Multiple databases support multiple databases becomes easy, you don't need a SessionFactoryPath, you simply give Burrow an entity type, and Burrow will find the right ISession for you. If you are using GenericDAO, the multiple DB support can be very transparent - your code does not need to know there are multiple databases.
  • How do I learn more about NHibernate.Burrow?
  • How do I setup NHibernate.Burrow for my project?
    Please view Get Started.
  • Why did I get this "cannot find entity with Id x" error with my [EntityField] after I deleted it?
    That's because by default EntityField is using Session.Load() to load the entity for you. If you delete the entity, you need to reset that field to null, if you want to save this trouble, you can use [EntityFieldDeletionSafe] instead, it's basically the same except that it's using Session.Get(). Click here for detail about EntityFields
  • How do I setup multiple databases?
    Please view Get Started
  • How do I store data in HttpSession?
    You might already know that you can not store entity in HttpSession in an OpenSessionPerView mode which is what NHibernate.Burrow is using most of the cases. Instead, you can store entity id in session and load the entity with Id every time you use it. Thanks to NHibernate's cache, this won't bring any performance issue to your system. Actually in many cases when you think you need to use HttpSession, what you actually need is Long Burrow Conversation .
  • How do I do unit test under NHibernate.Burrow?
    To unit test under NHibernate.Burrow's management you need to write your Setup and TearDown logic as follows.
  • [SetUp]
    public void Initialize() {
      new BurrowFramework().InitWorkSpace();
    }
    [TearDown]
    public void Close() {
      new BurrowFramework().CloseWorkSpace();
    }
    Or you can use NHibernate.Burrow.TestUtil.TestBase as your NUnit unit test base class and override TearDowan() and SetUp() method to add your own TearDown and SetUp logic.
  • Is NHibernate.Burrow compatible with Ajax?
    NHibernate.Burrow is compatible with Ajax.Asp.net - the ajax framework provided by Microsoft.
  • Why I couldn't finish a long conversation in an UpdatePanel in an Ajax.ASP.NET project?
    If you keep getting a javascript alert window giving the error message "Sys.WebForms.PageReqeustManagerParserErrorExcpetion: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled." you need to add the following setting into you system.web section in your web.config

    <pages enableViewStateMac="false" viewStateEncryptionMode="Never" enableEventValidation="false">
  • What version of NHibernate is NHibernate.Burrow using?
    Burrow 1.0 alpha 1 is using NHibernate 2.0 Alpha 1.
  • What version of .Net framework does NHibernate.Burrow support?
    NHibernate.Burrow currently only works in .Net Framework 2.0
  • Does NHibernate.Burrow create session and transaction for every http request?
    Some existing OpenSessionPerView supporting HttpModule solutions create unnecessary session and transaction for every http request including requests for digital assets such as picture and css file. NHibernate.Burrow only creates session and transaction for http request handler that needs.
  • How do I change NHibernate configuration within Burrow on the fly?
    you can use the following code:
    IFrameworkEnvironment fe = new BurrowFramework().BurrowEnvironment;
    NHibernate.Cfg.Configuration cfg =  fe.GetNHConfig("PersistenceUnit1");
    ...
    //do whatever change you need to cfg
    fe.RebuildSessionFactories();
     

© NHibernate Community 2024