c#:
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? =20
Any help is appreciated whatsoever =20
=20
*** 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 =3D soap.method_01(inputXML);
ValidateXMLAgainstXSD(outputXML, "method_01.xsd");
=20
return outputXML;
}
public string method_02(string inputXml)
{
// note args change for each fn()
ValidateXMLAgainstXSD(inputXML, "method_02.xsd");
outputXML =3D soap.method_01(inputXML);
ValidateXMLAgainstXSD(outputXML, "method_02.xsd");
return outputXML;
}
....=20
.... 997 functions cut & paste & edited later
....
=20
public string method_999(string inputXml)
{
// note args change for each fn()
ValidateXMLAgainstXSD(inputXML, "method_999.xsd");
outputXML =3D soap.method_01(inputXML);
ValidateXMLAgainstXSD(outputXML, "method_999.xsd");
return outputXML;