Fix for MonoRail RC2 VS add-in not generating Active Record facility config correctly

posted @ Monday, March 19, 2007 12:00 AM

 

First, thanks Hammett for pointing me to the solution for this. 

(Hammett pointed me to the updated documentation for ActiveRecord and by copying that config, it fixes these problems.  In case you don't want to copy that config, see below about what the fixes are in case your curious and if you want to apply them to your current config.)

If you fire up VS and add a new MonoRail project using the wizard, enabling Active Record and Windsor integration, create a quick domain object mapped using Active Record, add it to the HomeController Index action and fire up the web app, you'll get this error (down further in the stack trace):

Item has already been added. Key in dictionary: 'hibernate.use_reflection_optimizer' Key being added: 'hibernate.use_reflection_optimizer'

To fix, remove the following line from the facilities.config file:

<add key="hibernate.use_reflection_optimizer" value="true" />

I believe this is because ActiveRecord is already taking care of adding this behind the scenes, so having in the config a second time is not necessary.

So then fire it back up and now you'll get this error message:

The user must provide an ADO.NET connection - NHibernate is not creating it.

To fix, just add the following line to the facilities.config file:

<add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />

That's it.  Now you can rock and roll!

Comments
No comments posted yet.
Post Comment






Please add 7 and 8 and type the answer here: