WCF ria 服务返回复杂类型列表
我有一个复杂类型实体
public class ComplexEntity : ComplexObject
{
private int _ID;
private string _Name;
private int _ParentID;
[Key]
[DataMember]
public int ID { get;set;}
[DataMember]
public string Name {get;set;}
[DataMember]
public int ParentID {get;set;}
}
、另一个实体
[DataContract]
public class ComplexEntitiesList : ComplexObject
{
[DataMember]
[Include]
[Association("CEntities_CEntity","ID","ParentID")]
public List<CompelxEntity> List {get;set;}
[Key]
[DataMember]
public int ID {get;set;}
public int LKEntitiesList()
{
List = new List<LKEntity>;
}
和一种方法:
[Invoke]
public ComplexEntitiesList GetPS()
{
return new ComplexEntitiesList() { List = /*..some logic*/});
}
在服务器端一切都很完美,但在客户端列表为空 有什么线索吗? }
I have a complex type entity
public class ComplexEntity : ComplexObject
{
private int _ID;
private string _Name;
private int _ParentID;
[Key]
[DataMember]
public int ID { get;set;}
[DataMember]
public string Name {get;set;}
[DataMember]
public int ParentID {get;set;}
}
and another one
[DataContract]
public class ComplexEntitiesList : ComplexObject
{
[DataMember]
[Include]
[Association("CEntities_CEntity","ID","ParentID")]
public List<CompelxEntity> List {get;set;}
[Key]
[DataMember]
public int ID {get;set;}
public int LKEntitiesList()
{
List = new List<LKEntity>;
}
and a method:
[Invoke]
public ComplexEntitiesList GetPS()
{
return new ComplexEntitiesList() { List = /*..some logic*/});
}
On the server side everything's perfect however the list comes empty at the client side
Any clues?
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为 Include 不适用于 Invoke-Operations。查看 silverlight.net 上的此问题并查看 Colin Blairs 的回答。您的方法 GetPs() 应该返回一个包含复杂对象的普通集合(又名列表)。
I think the Include will not work wit Invoke-Operations. Take a look at this question on silverlight.net and see Colin Blairs answer. Your method GetPs() should return a normal collection (aka. List) containing your complex objects.