Updating Castle Windsor from v2.5 to 3.0

Thursday, 8 March 2012

Late last year the Castle Windsor project released a major update to some of their components - from version 2.5 to 3.0.
There are some breaking changes (most of which are documented in the BreakingChanges.txt files for Core and Windsor), so I thought I’d highlight a few issues that may be more common.

ILogger

The logging abstraction interface has been simplified, with a number of the overloaded methods removed. Whereas before you might have called ILogger.Debug("A message {0}", arg1), you now would use ILogger.DebugFormat() instead.

Component Registration

In 2.5 you could use the .Unless() method to add a condition (usually to skip registration if component already exists). This method has been replaced with the equivalent OnlyNewServices() method.

IHandler

This used to have a 'Service' property. Now refer to the IHandler.ComponentModel property which has a Services collection property.

Facilities

Previously, the IWindsorContainer.AddFacility() method required a string 'key' parameter. This is has been removed.

IHandler.AddCustomDependencyValue

This method has been removed, but you can now use the new Depends() method instead during registration. eg.
Component.For<IService>()
.ImplementedBy<Service>()
.DependsOn(
    Dependency.OnValue("parameterName", "CustomValue")
);

IKernel.RemoveComponent

This method has been removed. There is now no way to remove a component.

Compatibility

NServiceBus 2.x

NServiceBus 3 is compatible with Castle 3.0, but if you're still using NServiceBus 2 and don't want to upgrade, you'll need to update your WindsorObjectBuilder class. Have a look at the source code in NServiceBus 3 and adapt it to your implementation - https://github.com/NServiceBus/NServiceBus/blob/master/src/impl/ObjectBuilder/ObjectBuilder.CastleWindsor/WindsorObjectBuilder.cs

NHibernate

As of NHibernate 3.2, there is no longer a requirement to have a Castle-compatible bytecode provider.
The old NHibernateIntegration facility is not compatible with Castle 3.0 or NHibernate 3.2.
There is an alternate facility- 'Castle NHibernate' that leverages FluentNHibernate for configuration. This has been patched to work with Castle 3.0 but not NHibernate 3.2 (partly because FluentNHibernate hasn't been updated for 3.2). It also depends on Castle.Transactions, which ironically whilst at version 3.0 isn't actually compatible with Castle 3.0 either.
So for the meantime if you want to use NHibernate with Castle 3.0 you're going to have to get your hands dirty and update those dependant projects yourself.
I've done some of this on forks of these projects, and will update this post to the source repositories when they are available.

Windows 8 first impressions

Friday, 2 March 2012

Microsoft made the "Consumer Preview" of Windows 8 available yesterday, and last night I downloaded it and installed it on my laptop (using Boot to VHD so I wouldn't affect my existing Windows 7 install).

First impressions are very positive. The install went smoothly, and I was able to add in my GMail account for the email and calendar apps.

One of the first things that I noticed was the weather app was using Fahrenheit. This is when I discovered a handy keyboard shortcut [Windows]+[C], which brings up the 'Charms' which are where you can change settings for the current application (and so it was changed to Celsius).

The new interface is quite a contrast from the traditional Windows desktop. Windows Phone users will find more similarities with the new desktop Metro interface. You can see the 'Metro-style' apps on the screen-shot above. They're the ones with the nice icons/tiles. The other icons are from the install of Visual Studio 2011. (This is a regular Windows application so you get regular icons). Again, like Windows Phone, the tiles for the new apps can update themselves (eg. the calendar, email etc).

The email and calendar apps are simple but functional. A number of other apps aren't fully working at the moment (most due to 'regional' restrictions).

So far it has been rock solid - no crashes to speak of.

The Metro interface lends itself well to touch interaction. Unfortunately I don't have a touch screen on my laptop but I can certainly see how touch would work pretty well with it - again the similarities to Windows Phone help.

I'll be experimenting with seeing what's involved with porting some of my Windows Phone apps to work on Windows 8.

Imagine Cup Video - Team Apptenders from Croatia

Saturday, 28 January 2012

Some of the first projects I worked on when I began my stint at UniSA many years ago was a number of multimedia applications for the School of Physiotherapy (now part of the School of Health Sciences). This was pre-Web, so these were CD-ROM apps - back when the CD burner cost about $6,000 and blank CDs were $20 each! Hence my interest in this Imagine Cup entry - using a Kinect controller to aid in physiotherapy exercises. Brilliant! Having a speech pathologist sister in-law also makes me wonder whether the Kinect could have applications in that field too. It does have a 4-microphone array, but I I'm not sure if it could pick up facial gestures with enough detail.

Tour Down Under 2012

Sunday, 22 January 2012

It's January again, and amongst other things means it's time catch up with the other riders of the Mud, Sweat & Gears bike club and participate in the Tour Down Under Challenge Tour ride.

This year's 138km ride started in Norwood and finished up in Tanunda (in the Barossa Valley).

Here's a map of the ride (the green line) and an elevation graph showing the two steep climbs - Anstey's Hill (20km) and Menglers Hill (120km). I entered the map on RunKeeper, but not sure why it doesn't show distances after 90km.

Route map of ride

This year was one of the best organised. There were regular refreshment stops along the route, and they were all well provisioned with water, and some with the obligatory bananas and fruit cake. I think there was over 6,000 participants this year – a bit less than last year (but then Lance wasn't riding this year so that's to be expected)

I rode again with Dad (as featured in the January 18th edition of the Hills & Valley Messenger newspaper!). I've managed to do a bit more riding to work over the last few months, and I think that combined with a few longer training rides with Dad on the previous weekends made for a much better ride than last year for me.

image

We left Norwood just before the official start time of 6.30am and got to Tanunda around 1pm. Apart from a sore behind and tired legs I felt pretty good at the end. It was nice to make the finish and ride under the big arch (if you're too slow then they make you detour around so the professional riders have a clear run to the finish).

It was a really good day to ride, with the first few hours being nice and cool. The sun only started to break through towards the end of our ride. By the time we finished it was pretty warm.

image

Tanunda is a pretty town and it was nice to have large leafy trees providing shade to the spectators watching approach to the finish line.

Special thanks to Narelle's parents who transported Dad, I and our bikes to Norwood in the morning, and also followed us around the route, including right to the finish line. I'm glad I got a lift home with them rather than some people I saw who were riding back to Adelaide again after the ride!

Christmas baking

Saturday, 17 December 2011

Christmas has always been one of my favourite times of the year. Probably because growing up, Mum would always be making yummy things to enjoy before, during and after Christmas day.

I wouldn't put myself in the same class as Mum, but I do like doing a bit of cooking too – particularly the sweeter recipes Smile

image

Here's some shortbread and mince pies that I made today. I think I should have cut the pastry for the pies smaller as it expanded a bit when it was cooked. Still tastes nice though.