3

我正在使用 Flex 的 Mate 框架并与运行 C# 的服务器进行通信。我在将 C# 类映射到 ActopnScript 类时遇到问题。我已经让它适用于简单的类和内置的数据类型。

如果我的 API 中有一个返回 API.Foo.Result< API.Foo.Bar > 的 C# 方法,我应该为 RemoteClass 别名使用什么名称?我是否需要为 API.Foo.Result 的每个变体创建一个单独的 ActionScript 类?

如何调用将类作为参数的 C# 方法?使用具有相同名称的成员创建一个 ActionScript 类似乎不起作用。

处理包含对象数组的 C# 类的最佳方法是什么?似乎被转换为对象的 ArrayCollections。有没有办法将它们转换为我的特定类的 ArrayCollection?

4

1 回答 1

2

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...

于 2010-04-22T18:10:28.657 回答