I have an interface which contains properties of type ICommand
. When I serialize my concrete class instances that implement this interface, the ICommand
properties are also serialized:
public interface IMyInterface : ICloneable, IEditableObject, INotifyPropertyChanged
{
ICommand CmdMainDbBrowseButtonClicked { get; }
ICommand CmdAnalyticsDbBrowseButtonClicked { get; }
ICommand CmdMediaDbBrowseButtonClicked { get; }
ICommand CmdWebTrakDbBrowseButtonClicked { get; }
ICommand CmdTestButtonClicked { get; }
}
JSON serialized form:
[
{
"CmdMainDbBrowseButtonClicked": {},
"CmdAnalyticsDbBrowseButtonClicked": {},
"CmdMediaDbBrowseButtonClicked": {},
"CmdWebTrakDbBrowseButtonClicked": {},
"CmdTestButtonClicked": {},
...
}
]
This presents a problem when deserializing, as the deserializer does not know the concrete type of ICommand
is RelayCommand
.
How can I completely disable the serialization of the ICommand
properties, or coerce their types to RelayCommand
at deserialization time?