This forum has been archived. Please start a new discussion on GitHub.

C# AMI mapping question/suggestion

Hi Zeroc people.

I'm curious about the mapping chosen for AMI methods in C# and have a probably-naive suggestion that would make my life easier in one limited scenario.

It seems slightly cumbersome to have to extend a different abstract class for every unique AMI method you call. I understand that this class does two things: it provides callback methods and allows the caller to provide context for handling the response. In C#, I expected a solution that involved delegates and a separate context object passed to the call and passed back to the callback methods.

It could be argued that the effect is the same and the only difference is syntax: after all, the developer still has to provide custom code to process the result of each method. This is true unless the processing that needs to happen is generic. I have a GUI app where I'm filling up a grid with values from a server. The calling code needs to know what server method to call, but all the callback needs to do is plop the return value in the right table cell. It doesn't care what method was called. So if Ice used delegates and a context object for callbacks, I could write a single method to handle responses from the server (at least for all server methods with the same signature). Under the current mapping, I just shrugged and said, "oh well, I don't need async *that* much."

Has such a mapping been considered? Are there implementation problems I'm missing?