[er] create a remote method... (solved)

Topics: Technical Support
Nov 9 at 4:01 AM
Hello, if someone could help. My question is I need to create a remote method receives as variable parameters and a memory table the way the customer can return the variables changed by the server and on the table the result of a query to the database. I hope you can help me with an example because I'm starting my first practice with remote methods. Thank you. An example would .net me.
Coordinator
Nov 12 at 9:22 PM
Hello, your question is too broad. I can't quite understand what are you trying to achieve.

Please post the code you've come up so far, and I'll try to help you fix it if it doesn't work as intended.

Regards, Alex.
Coordinator
Nov 12 at 10:36 PM
As far as I can understand, you're trying to do something like this:
public class MyServer
{
     public void ProcessData(ref int variable1, ref string variable2, MyTable dataTable)
     {
            variable1 = 1;
            variable2 = "Hello";
            LoadDataFromTheDatabase(dataTable);
     }
}
It won't work that way with any RPC framework known to me (Zyan, WCF, NFX, whatever).
With RPC, you have to make a clear distinction between input parameters and return values.
So you should refactor your code into something similar to this:
[Serializable]
public class MyData
{
       public int Variable1 { get; set; }
       public string Variable2 { get; set; }
       public MyTable DataTable { get; set; }
}

public class MyServer
{
        public MyData ProcessData(MyData data)
        {
              data.Variable1 = 1;
              data.Variable2 = "Hello";
              LoadDataFromDatabase(data.DataTable);
              return data;
        }
}