views:

195

answers:

1

I'm using the Mate framework for Flex and communicating with a server running C#. I'm having trouble mapping C# classes to ActopnScript classes. I've got it working fine for simple classes and built in datatypes.

If I have a C# method in my API that returns a API.Foo.Result< API.Foo.Bar > what name do I use for my RemoteClass alias? Do I need to make a separate ActionScript class for each variation of the API.Foo.Result?

How do I call C# method that takes a class as a parameter? Making an ActionScript class with members with the same names doesn't seem to work.

What is the best way to handle C# classes that contain arrays of objects? The seem to get converted to ArrayCollections of Object. Is there a way to get them converted to an ArrayCollection of my specific class?

+1  A: 

Question/Answer

If I have a C# method in my API that returns a API.Foo.Result what name do I use for my RemoteClass alias?

The AS class name could be anything. But you have to specify the C# class name inside the remote class annotation.

[RemoteClass(alias="API.Foo.Result")]
public class Result VO
{
    ...
}

More info...


Do I need to make a separate ActionScript class for each variation of the API.Foo.Result?

Briefly, Yes. I didn't found info about inheritance for classes mapped in FlourineFX. probably you are going to need to map each one individually.


How do I call C# method that takes a class as a parameter?

There is an example using a web service that receive a DTO Here.

Just like using an AS RemoteObject. ; )


What is the best way to handle C# classes that contain arrays of objects?

This is the type mapping for FlourineFX (including collections). For Flex remoting this is a great example.

And they used them transparently in the documentation.


Hope it helps you...

SDReyes