Sorry for not so discrptive title, if someone wants to change it go ahead. Also note I have already asked a question about this kind of thing but this one is more about how you would attack it because my attack just doesn't seem to feel right.
I am having a problem with building a string up to send to an OLE object in the correct order using the polymorphism method in the other question.
The OLE object can only take and receive a string, so what I am doing is building a wrapper around all the common commands and providing a more .NET feel for them.
The problem I ran into very fast was some of the commands that my wrapper had to send where very long and had optional bits which then suddenly turned a method that was only setting a name into a big string building method with if's just to set a name and of course this happens all over the place because there are a lot of commands.
Now in order to have a good wrapper I would like to be able to wrap up the string building process so that I move the string building logic away from the wrapper itself and into a builder object.
I tried to attack this by using polymorphism which works well when I have a builder object class designed just for building that one type of command string. See other post for details.
Sorry for the long post I will cut to the chase now.
The main problem is that there is a lot of command strings that have to be built up which means more builder objects.
So I would really like to have a generic string builder that can build a string from any list of commands but the catch is they have to be in the correct order even if the user sets them in the wrong order.
How would you approach this?