Contents

How to Generate NHibernate Configuration Using ActiveWriter

Contents

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.

http://altinoren.com/content/binary/NHibernateGenerationDetail.png

  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.
Update:
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: http://builds.castleproject.org/cruise/index.castle

FONTE :

http://altinoren.com/default.aspx