hits counter

Upgrading the WCSF EventBroker Extension to WCSF 2.0

While preparing the demos for my session at TechDays Portugal 2008, I've noticed some changes in the Web Client Software Factory 2.0 that prevented the EventBroker Extension from compiling and running.

The problem ended out just being a little change in the WebClientApplication class. The virtual methods related to creating the builders changed.

To fix this, all it's needed is editing the WebClientApplication class (CompositeWeb\WebClientApplication.cs, line 35).

Just replace the CreateBuilder override:

protected override Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilder CreateBuilder(bool isSingleton)
{
    // Our builder adds an EventBrokerStrategy to the build.
    WCSFBuilder builder = new WCSFBuilder();
    builder.Policies.SetDefault<ISingletonPolicy>(new SingletonPolicy(isSingleton));
    return builder;
}

with an override of the AddBuilderStrategies method:

protected override void AddBuilderStrategies(IBuilder<Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilderStage> builder)
{
    base.AddBuilderStrategies(builder);
    builder.Strategies.AddNew<EventBrokerStrategy>(Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilderStage.PostInitialization);
}

Don't forget that if you want to run it in IIS7 Integrated Pipeline mode, you have a few more changes to make.

No Comments