RIA 服务定制类
使用 Silverlight 3 和 RIA 服务,我在 Web 项目中定义了以下类:
public class RegionCurrentStates
{
public RegionCurrentStates()
{
Name = String.Empty;
States= new List<State>();
}
[Key]
public string Name { get; set; }
public List<State> States{ get; set; }
}
但是,在客户端上,该类仅与 Name 属性一起显示。国家没有出现在任何地方。我假设我一定丢失了某种元数据,但我不知道它是什么。
编辑:我应该澄清 State 是 LinqToSql 生成的类。
Using Silverlight 3 and RIA Services I have the following class defined in my Web project:
public class RegionCurrentStates
{
public RegionCurrentStates()
{
Name = String.Empty;
States= new List<State>();
}
[Key]
public string Name { get; set; }
public List<State> States{ get; set; }
}
On the client, however, the class only shows up with the Name property. States doesn't show up anywhere. I'm assuming that I must be missing some sort of metadata but I don't know what it is.
Edit: I should clarify that State is a LinqToSql generated class.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅:RIA 服务概述 - 4.8.1 返回相关实体。
在返回 RegionCurrentStates 列表的服务函数中添加 DataLoadOptions 并在元数据描述中将 Include 属性添加到 States 属性。
在域类中定义的查询函数中添加 DataLoadOption。
在元数据中:
祝你好运。
Please see: RIA Services Overview - 4.8.1 Returning Related Entities.
In service function where you return RegionCurrentStates list add DataLoadOptions and in metadata description add Include attribute to States propriety.
Add DataLoadOption in your query function defined in domain class.
In metadata:
Good luck.