vendredi 1 juillet 2016

Converting JSON's jobject to a derived class

I have an abstract class named NProcess from which I will derive many Process objects.

Each Process has a ProcessSettings property which is of type (abstract class ProcessConfigurations) The types derived from these are browsable in PropertyGrid

I am Serializing the settings and storing them in the database as BSON.

Problem: Deserializing shows me the JSON string but I get the following error: Cannot implicitly convert type 'Newtonsoft.Json.Linq.JObject' to 'ProcessConfigurations'

I need to be able to cast or convert the JObject to any Type derived from 'ProcessConfigurations' but I am unable to get the derived type.

How can I do that?





Aucun commentaire:

Enregistrer un commentaire