Passing an [in] parameter to an asp.net web service
-
Hi, Consider a class that I need to serialize and send over the wire. On the receiving end, the serialization bytes have to be re-constructed to form the object. The mentioned class has got some member variables and one or more constructors.
[WebMethod()] public void Test(MyClass c) {}
The question is that is there anyway to control the proxy-generation for the MyClass class? i.e, how am I supposed to force the proxy-generator to generate the constuctors? Or should I add the required constructors on the client side using the partial keyword? What's the best thing to do when you want to pass a one-way informative parameter (ie., no functionality embedded except for the constructors) to a web method? I would like the client side to create the object normally as follows:MyWebService.MyClass c = new MyWebService.MyClass(param1, param2); MyWebService.Test(c);
Is there anyway to achieve such functionality? TIA, Mehdi -
Hi, Consider a class that I need to serialize and send over the wire. On the receiving end, the serialization bytes have to be re-constructed to form the object. The mentioned class has got some member variables and one or more constructors.
[WebMethod()] public void Test(MyClass c) {}
The question is that is there anyway to control the proxy-generation for the MyClass class? i.e, how am I supposed to force the proxy-generator to generate the constuctors? Or should I add the required constructors on the client side using the partial keyword? What's the best thing to do when you want to pass a one-way informative parameter (ie., no functionality embedded except for the constructors) to a web method? I would like the client side to create the object normally as follows:MyWebService.MyClass c = new MyWebService.MyClass(param1, param2); MyWebService.Test(c);
Is there anyway to achieve such functionality? TIA, MehdiAfter the code has been generated, you can add them. As long as you stick to serialization standards (mark your public properties/fields as XmlIgnore, and dont delete their fields!). If using .NET 2.0, partial classes gets generated, and hence u can define them in another file without worrying that regeneration will erase your changes.
**
xacc.ide-0.2.0.57 - now with C# 2.0 parser and seamless VS2005 solution support!
**
-
After the code has been generated, you can add them. As long as you stick to serialization standards (mark your public properties/fields as XmlIgnore, and dont delete their fields!). If using .NET 2.0, partial classes gets generated, and hence u can define them in another file without worrying that regeneration will erase your changes.
**
xacc.ide-0.2.0.57 - now with C# 2.0 parser and seamless VS2005 solution support!
**
Is there any keyword and/or pragma (like the one used in IDL (C++)) to force the compiler to put some code in the generated class? something like:
#include_this_in_generated_code "public void WhateverMethod() {}"
This way, I could alter the proxy code on service-side. Thanks, Mehdi