Selective serialization with SubSonic generated classes?

IXmlSerializable is IMO more than a little awkward to get right. Note that if you are handling the XmlSerializer code yourself you can override everything at runtime by using the constructor that accepts XmlAttributeOverrides (but if you use this you should cache and re-use the XmlSerializer instance, or it will leak like a sieve) You briefly mention protobuf note that protobuf-net (even in v1) allows you to add member-level serialization data at the type level, so you can include that information in a partial class alongside a generated type: file 1 partial class GeneratedClass { public int Foo { get; set; } public string Bar { get; set; } } // file 2 ProtoPartialMember(1, "Foo") ProtoPartialIgnore("Bar") partial class GeneratedClass {}.

IXmlSerializable is IMO more than a little awkward to get right. Note that if you are handling the XmlSerializer code yourself you can override everything at runtime by using the constructor that accepts XmlAttributeOverrides (but if you use this you should cache and re-use the XmlSerializer instance, or it will leak like a sieve). You briefly mention protobuf; note that protobuf-net (even in v1) allows you to add member-level serialization data at the type level, so you can include that information in a partial class alongside a generated type: // file 1 partial class GeneratedClass { public int Foo { get; set; } public string Bar { get; set; } } // file 2 ProtoPartialMember(1, "Foo") ProtoPartialIgnore("Bar") partial class GeneratedClass {}.

Thanks Marc, big fan of your protobuf implementation, crazy fast. Though I can control the serialization manually, the endgame is that other people could consume the web services as well. I was hoping to have a more automagic approach, e.g. The user is presented with an XSD/WSDL which has no mention of the rest of the SS hierarchy.

Then they generate their classes from it and so on. – joe Nov 17 '10 at 20:16 @joe - in that case, I would recommend simply creating a separate DTO layer that is similar to the SS types, but under your direct command. – Marc Gravell?

Nov 17 '10 at 20:25 That was my original workaround. :) Though I did do it by hand, which is what I meant by unsustainable. I suppose it could be rather automatic with SS templates eh?

I'll try this out and post the results. – joe Nov 17 '10 at 20:34.

I'm rather unfamiliar with SS's templates, but it seems that editing these would allow me to generate the serialization code necessary to not touch the rest of the hierarchy chain. Is this a "good idea"? I'd love to just use SS's POCO support, but I don't think it supports complex types or arrays.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions