Print Page | Close Window

Remote Service Method Question

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2405
Printed Date: 05-May-2025 at 6:11pm


Topic: Remote Service Method Question
Posted By: BillG
Subject: Remote Service Method Question
Date Posted: 28-Dec-2010 at 11:44am
I am creating my first Remote Service Method and I want to make sure that I get the first one right as I will have about 5 of these in the app.
 
I have a class named MemberBalanceCalculator. The purpose of the class is to sift through all of a members assessments and payments and figure out a balance owing.
 
The class is located in the LaborWareWeb app and in a directory called RemoteCalls.
 
The method to call in the MemberBalanceCalculator is CalculateAmountOwing.
 
So what is the code going to look like on the client side? How can I pass a complex object to a Remote Service Method. I need to pass a member object or should I pass the string SSN and have the remote service method look up the member and read it into memory?
 
public void CalculateBalance(string ssn)   // what if I want to pass over the member object instead of just the ssn?
{
        string typeName = LaborWareWeb.RemoteCalls.MemberBalanceCalculator, LaborWareWeb";
        string methodName = "CalculateAmountOwing";
 
       var op = Mgr.InvokeServerMethodAsync(typeName, methodName, null, null, ssn);
        op.Completed += (o, args) => {
                    //refresh member object in memory to display the new updated values on the view.
        } 
}
 
Do I need to make any entries in the web config to tell it about this remote service method?
 
Bill
 
 



Replies:
Posted By: DenisK
Date Posted: 28-Dec-2010 at 1:50pm
Hi BillG;

You can pass a complex object to the InvokeServerMethodAsync method. The last argument that this method takes is params object[] so you can pass any number of object type.



Print Page | Close Window