Visual Studio Office Tools and Word 2003 using deserialization, nightmare end
I finally fixed the issue I reported in the post “New milestone reached in the development of the authoring tool for Tech Head Brothers French portal “. I am still waiting some feedback from Peter (he might be in holidays).
What I did is to use SGen tool from Daniel Cazzulino described in this post: “Strongly-typed, event-rising, design-time generated custom XmlSerializers (even more than Whidbey sgen!) “. I also used Mike Woodring code described in the post: “The Last Configuration Section Handler I’ll Ever Need“. I mixed all and modified XmlSerializerSectionHandler from Mike so that it doesn’t return a fixed IDictionary but an object. With reflection I can determine which Handler to instantiate, then from this handler I call it method Create and I get something like that to deserialize an object from the configuration file:
SchemaSettings schemaSettings = (SchemaSettings)AssemblySettings.GetConfig(“SchemaSettings”);
With the configuration:
<SchemaSettings type=”THBPublisher.SchemaSettings, THBPublisher” serializer=”THBPublisher.SchemaSettingsSerializer, THBPublisher” reader=”THBPublisher.SchemaSettingsReader, THBPublisher”>
</configuration> So the good point at the end is that I have a configuration file looking like a normal one, that I can get configuration settings from even deserialize object from it. Nice.