Why aren't custom ServiceStack.Text deserialization settings applied?

I am using ServiceStack.Text with ServiceStack (web service infrastructure).

I am trying to add a special serialization route for a specific type in AppHost.Configure(). However, the settings are not applied / ignored.

public AppHost : AppHostBase 
{
    ...

    public override void Configure(Container container)
    {
        //Register custom serialization routine
        ServiceStack.Text.JsConfig<CultureInfo>.SerializeFn = r => r.TwoLetterISOLanguageName;
        ServiceStack.Text.JsConfig<CultureInfo>.DeSerializeFn = r => return new CultureInfo(r);    
    }
}
+5
source share
1 answer

ServiceStack.Text is very cached to achieve high performance. ServiceStack is already starting the process of creating a cache before the call AppHost.Configure().

So, to solve this problem, you need to register your settings before the call AppHost.Init().

, ServiceStack.Text - , , AppHost.Configure().

+7

All Articles