Sir Thomas - 402 - Sep 15, 2014

I think I might have found an odd quirk in the Redis client when using generic types:

this fails:  var obj = Redis.GetFromHash<T>(id) 
this works:  var obj = Redis.GetFromHash<MyCustomClass>(id) 

Oddly, in the version that fails using generic type T, Redis correctly generates the key, can correctly fetch the hash entries using GetAllEntriesFromHash, but the feeding to JSON deserializer throws exception.  Haven’t yet gone into the source code yo identify a workaround.

Thoughts anyone?

Darren Reid:

What’s <T> at the time of the GetFromHash method call that fails? 

Sir Thomas:

Can be a few different classes that I am using.  the GetFromHash is wrapped in a generic method so that the same steps can be applied to multiple types that are used.  The strange part is that if the type is passed generically via a <T> method, it failed, but when the type was specified explicitly, it succeeded.

Sir Thomas:

[Solved]  User error.   +Darren Reid  your question prompted me to look more closely at the type that was passed to the method, and found that it was ambiguous between a different type, with same name, in the SS framework.  So, the calling class was passing the service stack’s T, and the class receiving it doing the work had my namespaces defined and was trying to deserialize into a different T.

Works like a charm now.