I've a few Classes from a assembly which is .Net 2.0. These Classes are marked with Serializable.
In my project, I use these classes in my Classes, which are marked with DataContract(IsReference=true) and DataMember.
Now I have the problem, with DataContractSerialiser that it serializes the private fields of my .Net 2.0 Classes, which will not work. But when I use XMLSerialiser, I cannot use IsReference, and so I can also not do this.
Is there a easy (simple) Solution for this? Maybe a someone has a own XMLSerializer which supports references?
Here is a bit of my code:
[DataContract(IsReference = true)]
public class ConnectionConfig: INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void NotifyPropertyChanged(String info)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(info));
PropertyChanged(this, new PropertyChangedEventArgs("ObjectAsString"));
}
}
private PLCConnectionConfiguration _configuration;
[DataMember]
public PLCConnectionConfiguration Configuration
{
get { return _configuration; }
set { _configuration = value; NotifyPropertyChanged("Configuration"); }
}
}
where PLCConnectionConfiguration comes from a .NET 2.0 assembly, and is decorated with [Serializeable]