2010-02-16

Experiences on upgrading EPiServer 4.51 to 4.62B part 2

Ok, so the upgrade has been done, but will the project compile?

Sadly the answer is no.

I got the exact same problems described here: http://world.episerver.com/templates/forum/pages/thread.aspx?id=19575&epslanguage=en. It took some time for me to understand the answer to the part they did give an answer to. They didn’t answer the second question at all.

Problem 1: WsrpHelper doesn’t exist any more

My solution, which saves me from having to go through 8-10 places and correct the code, was to create a new class inside the WsrpPortal.aspx.cs file:

class WsrpHelper
{
    public static IConsumerEnvironment ConsumerEnvironment
    {
        get { return ElektroPost.Wsrp.Consumer.ConsumerContext.ConsumerEnvironment; }
        set { ElektroPost.Wsrp.Consumer.ConsumerContext.ConsumerEnvironment = value; }
    }

    public static void EnsureConsumerEnvironment()
    {
        if (ElektroPost.Wsrp.Consumer.ConsumerContext.ConsumerEnvironment == null)
        {
            ElektroPost.Wsrp.Consumer.ConsumerContext.ConsumerEnvironment = ConsumerFactory.ConsumerEnvironmentInstance();
        }
    }
}

Problem 2: LanguageManager.GetContextLanguage() is obsolete

It says in the error message that you should use LanguageContext.Current as a replacement, but that would create a type conversion exception.

I am guessing that you can to use LanguageContext.Current.CurrentUILanguageID as a replacement for GetContextLanguage() (please do correct me if I’m wrong).

DISCLAIMER:
I haven’t been able to test my solution, since the webs I am working on don’t actually use the portal framework. My code compiles now, so the web is up and running, and I am happy for the time being. If anyone finds any flaw in my solutions please don’t hesistate to leave a comment.

No comments:

Post a Comment