Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Tue, 17 Jun 2008 22:59:16 -0700 (PDT),    group: microsoft.public.dotnet.framework.remoting        back       


Dynamic Method Call   
Hi folks,

I have hundreds of methods exposed on the app server via remoting. Is
there a way for a client to dynamically invoke any one of these
methods if I know the class name, method name and have a string
containing the serialized objects to be passed as the method params? I
would also like to retrieve the object the method returned, as a
serialized string.

Thanks.
date: Tue, 17 Jun 2008 22:59:16 -0700 (PDT)   author:   R3al1ty

Re: Dynamic Method Call   
Well, create a remoted object that takes the class, method, and the string 
array containing the arguments. You can use the activator class to create an 
instance of the object that you needed it to create, and use reflection on 
that object to invoke the method.

As for the return, you could use the XmlSerializer to serialize the object 
being returned as a string.

"R3al1ty"  wrote in message 
news:6e63b758-cd21-448d-af54-cfc3610e931c@j33g2000pri.googlegroups.com...
> Hi folks,
>
> I have hundreds of methods exposed on the app server via remoting. Is
> there a way for a client to dynamically invoke any one of these
> methods if I know the class name, method name and have a string
> containing the serialized objects to be passed as the method params? I
> would also like to retrieve the object the method returned, as a
> serialized string.
>
> Thanks.
date: Sun, 22 Jun 2008 15:10:00 -0400   author:   Jeff Winn

Re: Dynamic Method Call   
Sorry, I should have been more detailed. Performance is a key concern,
which is why we did not want to use Reflection. On those lines, how
expensive is even the Remoting part of things when it creates a remote
object?

Thanks
date: Mon, 23 Jun 2008 01:46:31 -0700 (PDT)   author:   R3al1ty

Re: Dynamic Method Call   
You have no choice in the matter whether you want to use reflection to 
invoke the method. The objects themselves I'm not sure how much more 
overhead is required for the objects when they're remoted, never bothered to 
look. When I need to remote something, I just do it.

If you're worried about performance with Reflection, cache the MethodInfo 
instances for the type in a collection (as an example I'd probably use a 
dictionary with the name of the method being the key). However if you're 
also remoting overloads you'll need to add more data to the key to ensure 
they're kept unique. Performance on the remoting side of things depends on 
the type of remoting you're using for an object. Single call is going to 
reduce performance a lot more than singleton would. It really all depends on 
what your application is needing.


"R3al1ty"  wrote in message 
news:f1a9e952-f3bf-45f6-bd3b-304bdde0f97d@w34g2000prm.googlegroups.com...
> Sorry, I should have been more detailed. Performance is a key concern,
> which is why we did not want to use Reflection. On those lines, how
> expensive is even the Remoting part of things when it creates a remote
> object?
>
> Thanks
date: Mon, 23 Jun 2008 18:50:54 -0400   author:   Jeff Winn

Re: Dynamic Method Call   
I'll keep these points in mind, thanks!
date: Wed, 25 Jun 2008 00:04:36 -0700 (PDT)   author:   R3al1ty

Re: Dynamic Method Call   
Not a problem, good luck with your project :o)

"R3al1ty"  wrote in message 
news:a1de1cbd-7a95-4493-b547-49aef1cad8de@c19g2000prf.googlegroups.com...
> I'll keep these points in mind, thanks!
date: Thu, 26 Jun 2008 01:06:57 -0400   author:   Jeff Winn

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us