c# - Serializing reference of stateful + stateless objects -
this kind of design problem:
class suite { list<plugins> plugins {get;set;} } class datacollector : plugin { string property1 {get;set;} string property2 {get;set;} public void printmyname(); } class measurement: plugin { string property1 {get;set;} string property2 {get;set;} public void printmyname(); } now, want class suite serializable. problem here this:
xml serialization used serialize dto kind of objects serialize/deserialize stateful properties , fine
this particular class going serialized contains of type plugin(which contains combination of properties contains property values) + functionalists.
which means need utilize mill real instance of object plugin come life functionality property values.
am looking @ xmlsrializable + mill combination? there elegant way accomplish this?
why not implement ideserializationcallback interface upon deserialization can bring object life via phone call factory.
i don't understand purpose of classes, give illustration best can:
public class mydataclass : ideserializationcallback { public int simplekeyproperty { get; set; } public string textproperty{ get; set; } public void ondeserialization(object sender) { //upon deserialization utilize int key latest value //factory (this create believe...) textproperty = somefactory.getcurrentvalue( this.simplekeyproperty) ; } } c# .net xml serialization factory
No comments:
Post a Comment