How can i solve this simple problem without using reflection

  • Thread starter Thread starter Ste
  • Start date Start date
S

Ste

I am connecting to a web service and wsdl has generated a lot of methods for it. I am creating a wrapper DLL that handles all the communication with the web service (uses WSE and such) to hide the complexity and do full validation etc..

Each method takes the same input param and needs to call a distinct validation fn(). [ see example below ]

How can i avoid cutting and pasting 100's of fn()'s eg...

I can use reflection to dynamically create each fn() on demand - but then my clients would not see a nice list of fn()'s and parameters in the "object browser".

Is there anyway i can get Visual Studio to autogenerate the methods based upon some form of template - eg an [attribute] .. dont think so - but i thought i would ask?

Can anyone suggest a nice pattern?

Any help is appreciated whatsoever


*** How can i avoid cutting and pasting 100's of fn()'s eg...


public string method_01(string inputXml)
{
// note args change for each fn()
ValidateXMLAgainstXSD(inputXML, "method_01.xsd");
outputXML = soap.method_01(inputXML);
ValidateXMLAgainstXSD(outputXML, "method_01.xsd");

return outputXML;
}

public string method_02(string inputXml)
{
// note args change for each fn()
ValidateXMLAgainstXSD(inputXML, "method_02.xsd");
outputXML = soap.method_01(inputXML);
ValidateXMLAgainstXSD(outputXML, "method_02.xsd");

return outputXML;
}

....
.... 997 functions cut & paste & edited later
....

public string method_999(string inputXml)
{
// note args change for each fn()
ValidateXMLAgainstXSD(inputXML, "method_999.xsd");
outputXML = soap.method_01(inputXML);
ValidateXMLAgainstXSD(outputXML, "method_999.xsd");

return outputXML;
}
 
Hi Ste,
I am connecting to a web service and wsdl has generated a lot of
methods for it. I am creating a wrapper DLL that handles all the
communication with the web service (uses WSE and such) to hide the
complexity and do full validation etc..
Each method takes the same input param and needs to call a distinct
validation fn(). [ see example below ]
How can i avoid cutting and pasting 100's of fn()'s eg...

May be 'Assembly enhancing' is possible idea here (autotranslated!) :
http://www.dzaebel.net/ExtendYourAssembliesAfterCompiling.htm


ciao Frank
 
Back
Top