vendredi 16 juin 2017

Get IReliableDictionary via reflection returns DistributedDictionary

I am trying to setup an IReliableDictionary with serialized state from external storage.

Thing is, the generic argument's types come as assembly qualified names - so to get the IReliableDictionary from StateManager, I need to create the generic method of GetOrAddAsync with type arguments that I provide, and invoke it on StateManager.

Next step is to use dynamic and call ContainsAsync and then SetAsync on this supposed-to-be-IReliableDictionary.

Turns out though, that I get a DistributedDictionary back, and it doesn't have those methods, so I get exception with 'object' does not contain a definition for 'ContainsKeyAsync'.

I fail to find a way to get an IReliableDictionary back, as I would normally do when not calling the method via reflection. What can I do here?





Aucun commentaire:

Enregistrer un commentaire