in

CodePrairie .NET

South Dakota .NET User Group

chrisortman

Catching up with Castle trunk 4710

I've just got done updating one of my projects from castle trunk 4044 to trunk 4710 and given the amount of changes thought I would share.

First things first, fix up those compiler errors. I had quite a few, but they were easy and pretty much the same few things:

  • Rename IRailsEngineContext to IEngineContext
  • Change Filter methods to accept IController and IControllerContext instead of just Controller.
  • No more Context.Url, now it is Context.Request.Url
  • SetController method on helpers has changed to take IController and IControllerContext instead of Controller.
  • Since helpers now use IController instead of Controller there may be several missing methods or properties so just cast it to an instance of Controller.

 

I'm so glad I have unit tests. When I first ran them I had many failures, but it was one fix:

Error:

Inner Exception
NHibernate.HibernateException
Message: Could not instantiate dialect class
Source: NHibernate

Problem:

The key names for NHibernate configuration have changed

Solution:

Change your ActiveRecord configuration entries from this

<add key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />

to

<add key="connection.driver_class" value="NHibernate.Driver.SqlClientDriver" />

 

Then to get my site up and running:

Error:

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load type 'Castle.MonoRail.Framework.EngineContextModule'

Problem:

There is no more EngineContextModule

Solution:

Remove this from web.config <add name="monorail" type="Castle.MonoRail.Framework.EngineContextModule, Castle.MonoRail.Framework" />

 

Error:

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: An error occurred creating the configuration section handler for Brail: Could not load file or assembly 'Boo.Lang.Extensions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=32c39770e9a21a67' or one of its dependencies. The system cannot find the file specified.

Problem:

A new boo assembly has been added

Solution:

Add a reference to Boo.Lang.Extensions to your web project.

 

Error:

CommonScripts\Extensions.brail(7,9): BCE0044: Boo.Lang.Compiler.CompilerError: expecting "end", found 'except'. ---> CommonScripts\Extensions.brail:7:9: expecting "end", found 'except'

Problem:

I had defined an extension method in one of my brail common scripts that looked like

[Boo.Lang.ExtensionAttribute]
static def IsEmpty(val as duck) as bool:
	try:
		return true if val is null
		return val.GetEnumerator().MoveNext() == false
	end
	except e as System.MissingMethodException:
		return true
	end
end

Solution:

[Boo.Lang.ExtensionAttribute]
static def IsEmpty(val as duck) as bool:
	try:
		return true if val is null
		return val.GetEnumerator().MoveNext() == false
	except e as System.MissingMethodException:
		return true
	end
end

 

Of note:

Because of the new way MonoRail resolves its service container you can remove the useWindsorIntegration flag from your configuration. I think this will also mean you don't need to register a custom logging service as well.

Comments

 

Bart said:

Thanks for the helpful post on the latest monorail refactoring.

Did you notice any problems with localised strings? I am moving the WineCellarManager (code.google.com/.../winecellarmanager)

to the monorail trunk but all of a sudden the translations do not work anymore. I did not debug it yet however to see whether something changed on that part.

January 10, 2008 12:13 AM
 

Ken Egozi said:

"Since helpers now use IController instead of Controller there may be several missing methods or properties so just cast it to an instance of Controller."

That's not too good. what If someone implements IController, not using Controller?

instead, use methods on the IEngineContext.Response and Request when you can.

and as for the brail extension method - the problem and solution looks the same I think

January 10, 2008 12:14 AM
 

etal said:

Thanks,

This saved me a bunch of time figuring out why activerecord would not start properly.

January 10, 2008 12:34 AM
 

Ken Egozi said:

Oh just notices the 'end' in the second script.

January 10, 2008 1:16 AM
 

Jason Lodice said:

Thanks for the post.

Have you run into problems registering GridComponent and SmartGridComponent at the same time?  GridComponent is decorated with the ViewComponentDetailsAttribute and since SmartGridComponent inherits from GridComponent the call to Castle.MonoRail.Framework.Services.DefaultViewComponentRegistry.AddViewComponent throws an error saying the component is already registered.  I'm probably doing something wrong here, any tips would be appreciated.

January 10, 2008 6:45 PM
 

chrisortman said:

@Bart: Sorry I don't do any localization in this app. I remember seeing something like StaticResourceRegistry get added, may be what you're after.

@Ken: Agree, but since in these scenarios we already know that none of the controllers implement IController (since prior to updating it didn't exist) and in my app I am in control of which controllers are used in my helpers

@Jason: I haven't used the SmartGridComponent but I wouldn't doubt it is a bug.

January 10, 2008 7:36 PM
 

Jason Lodice said:

Thanks Chris, I found a solution, if others are interested, see the Castle Jira:

support.castleproject.org/.../MR-391

support.castleproject.org/.../CONTRIB-100

January 11, 2008 1:15 PM
 

Part 7: Services, Refactoring & Castle Trunk « Developing PixelBugs said:

Pingback from  Part 7: Services, Refactoring &amp; Castle Trunk &laquo; Developing PixelBugs

June 1, 2008 2:26 PM
 

Flominator said:

Great post. Helped me a lot, yesterday. Although I didn't really succeed: Please see forum.castleproject.org/viewtopic.php for details :(

January 9, 2009 12:14 PM
 

Guy said:

Good post. Helped a lot with the issue of EngineContectModule. Your post was the only place I found info about this error.

Thanks.

February 20, 2009 1:33 PM
 

Atualizando o Castle Monorail e Castle ActiveRecord « Luiz Fernando Signorelli said:

Pingback from  Atualizando o Castle Monorail e Castle ActiveRecord &laquo; Luiz Fernando Signorelli

November 23, 2009 11:08 AM
 

Blood clots cycle in menstrual - During menstrual - Menstrual cycle said:

Pingback from  Blood clots cycle in menstrual - During menstrual - Menstrual cycle

September 7, 2010 1:00 PM
 

Airline archive industry news - Airline archive - Airline news said:

Pingback from  Airline archive industry news - Airline archive - Airline news

September 14, 2010 10:00 AM

Leave a Comment

(required)  
(optional)
(required)  
Add
Powered by Community Server (Commercial Edition), by Telligent Systems