When I serialize my JSON object out of DocumentDB, my Control
is not serializing into the OptionsControl
with the Options
property.
I have the following class, Control
:
public class Control : IControl
{
public Guid Id { get; set; }
public virtual Enums.ControlType Type { get; set; }
public string PropertyName { get; set; }
public string ControlCssClass { get; set; }
public string Description { get; set; }
}
I also have OptionsControl
, which inherits from Control
:
public class OptionsControl : Control
{
public IDictionary<string, string> Options;
}
I used the Document Explorer in Azure to put this JSON in document
in a DocumentDB collection
:
Rows:
[
{
Controls:
[
{
"PropertyName": "Relationship",
"ControlCssClass": "",
"Description": "",
"Type": 3,
"Options": [
{
"Key": "Spouse",
"Value": "Spouse"
},
{
"Key": "Child",
"Value": "Child"
},
{
"Key": "Step-child",
"Value": "Step-child"
}
],
}
]
}
]
When I pull the data out of DocumentDB, I attempt to serialize it into my Row
class:
public class Row
{
public IList<Control> Controls { get; set; }
}
And of course, since I'm serializing into Control
, I get all of the properties on the Control except for Options
. What do I need to do so that the JSON object from DocumentDB serializes properly and turns into an OptionsControl
(has the Options property) instead of just the base Control?
Aucun commentaire:
Enregistrer un commentaire