How to Generate NHibernate Configuration Using ActiveWriter

Preview 3 has this functionality, but there are a few things to mention.
ActiveWriter use ActiveRecord assembly to generate NHibernate config files. So you’ll need Castle.ActiveRecord.dll, NHibernate.dll and all necessary dependincies to make it work.

  1. Set the target to NHibernate
    This way, AW will generate .hbm.xml files for each entity in your model.
  2. Set the Assembly Path to where Castle.ActiveRecord.dll, NHibernate.dll and all necessary dependincies reside.
    The design decision was that, I didn’t want to package these assemblies with AW. Rather than that, I thought user will most probably have them so they can choose whatever version they want to generate the configuration. If you don’t supply the path, AW (VS, actually) will look for them in GAc and then {Your VS Path}Common7IDECastle.ActiveRecord.dll, so if you have them in one of those places, it should be fine.
    One other quirk is, if you first try to generate with the wrong path, setti ng the correct one later won’t work until you restart Visual Studio. This is the framework’s limitation, once you try to load an assembly and get an error, the result will be cached for subsequent tries. So VS appdomain should be restarted to make it work. I’ll have a possible soliton for this for a future version of ActiveWriter (will try to load in a dummy appdomain, then in the VS appdomain)
    You may use the fully qualified assembly names for Active Record Assembly Name and NHibernate Assembly Name to target a specific version in the GAC, if you have more than one in there.
  3. When you save the model, AW will generate configuration.

I’ll prepare a better documentation in the wiki.
Have fun.
AW does not work with release version of Castle assemblies (RC2?) for NHibernate generation, it works with the trunk (or with recently compiled assemblies). You can use the latest bits from the build server:




  • Vien Via!

    Io non capisco.

    Perchè, avendo una padronanza dell’inglese pari "The Pen is on the table" scrivete post in questa lingua?

  • Carlo Bertini

    Come dice Ale, l ho riportato solo x il fatto che penso sia utile ad altre persone, se l’ ho avessi scritto io…..lasciamo perdere :D:D:D:D:D


  • deerchao

    That’s cool, and will be even cooler if I don’t have to add a new txt file named “xxx.actiw” into my project.
    I’m using VS Chinese Edition, is that the reason why I don’t have something properly showed up in the “add new item” dialog?

  • kraloyun