Losing Properties with Redis Deserialize from cache

I am storing a POCO that contains a couple of objects from the Stripe nuget package (Subscription and Customer) in redis cache.

my service does this:

var acct = new SubscriptionAccount() { ....};
acct.stripe_subscription = results from Stripe.SubscriptionService.Create(..) 

return acct;

the results from the method have the subscription items.

When I retrieve the account back from cache… the items value in stripe_subscription is null

(it’s not null in redis)

here’s the poco

public class SubscriptionAccount

        public long acct_id { get; set; }
        public string user_id { get; set; }
        public string email_address { get; set; }
        public string subscription_payment_id { get; set; }
        public string api_key { get; set; }
        public Subscription subscription { get; set; }
        public DateTime created_date { get; set; }
        public DateTime start_current_month { get; set; }
        public Stripe.Subscription stripe_subscription { get; set; }
        public Stripe.Customer stripe_customer { get; set;  }

Please provide a stand-alone example that can be run locally to repro the issue.

Feel free to start with the Redis example on Gistlyn if it’s easier, otherwise please provide a link to a small standalone (i.e. MCVE) project on GitHub.

Looks like unrelated to redis or cache… just in the deserialization. I am guessing stripe has some weird accessors but not sure how to deal with it. I could park the important aspects I need elsewhere before serialization if needed.

You’re using Stripe.NET not ServiceStack.Stripe. They annotate their DTO mappings with JSON.NET Attributes which are only going to work if you use JSON.NET.

If you’re going to use their DTOs you need to use JSON.NET to de/serialize it.