开发者

how to pass a custom class as parameter for ria service?

开发者 https://www.devze.com 2023-03-13 10:16 出处:网络
I want to pass a class instance with ria service by async call. For exam开发者_运维问答ple, I have a class defined as

I want to pass a class instance with ria service by async call. For exam开发者_运维问答ple, I have a class defined as

public MyClass{
   public int ID{get;set;}
   public string Name {get;set;}
   public ClassB {get;set;}
}

What I tried is to add anotation [DataContract] and [DataMember]:

[DataContract]
public MyClass{
   [DataMemebr]
   public int ID{get;set;}
   [DataMemebr]
   public string Name {get;set;}
   [DataMemebr]
   public ClassB {get;set;}
}

then I want to pass instance of MyClass in async call at client side. Not sure if this is working. and How to enable MyClass support databinding at client side?


To use classes with WCF RIA service you need to mark one member as the key using [Key].

It would also probably help if you spelt DataMemebr as DataMember (assuming that is not just a typo for this question. :)

If you are not using any features of RIA Services (can't tell from your example) you might just want to send it via a normal Siverlight WCF call instead of using RIA.

0

精彩评论

暂无评论...
验证码 换一张
取 消