Pregunta

I used to be able to save my customer AuthSession to the cache, but since upgrading it only saves the properties on the IAuthSession interface, not my class CustomUserSession.

The code runs here:

public class AcmeUserSession : ServiceStack.AuthUserSession, IAcmeUserSession
{

    public override void OnAuthenticated(IServiceBase authService, IAuthSession session,   IAuthTokens tokens, Dictionary<string, string> authInfo)
    {

     //code to update session object

     authService.SaveSession(this);     //*****HERE*****

    }
}

This code has not changed, but now when I look in redis at the saved object it only has properties from IAuthSession, not the custom properties from AcmeUserSession as it used to have.

Please help!

Thanks,

Richard

¿Fue útil?

Solución

Mythz answered this question perfectly. I quote him directly:

Because AuthUserSession is a DataContract and attributes are now inherited in v4, you also need to mark each member with [DataMember], e.g:

public class CustomUserSession : AuthUserSession
{
    [DataMember]
    public string Hello { get; set; }
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top