RIA 服务如何返回单个列?
我有一个自动完成框,用于选择汽车预订程序的目的地。对于自动完成框的项目源,我尝试将其设置为之前输入的所有目的地。问题是我无法弄清楚如何从我的 Booking 类返回包含不同目的地值的单列“目的地”,例如
var query = from bk in ObjectContext.Bookings select new DestinationDTO { Destination = bk.Destination };
return query.Distinct();
。我尝试创建一个共享的 DestinationDTO 类来仅返回单个列,但无法弄清楚如何让它从实体继承!
有什么想法吗?
I have a autocompletebox that is used to select a destination for a car booking program. For the itemssource of the autocomplete box I am trying to set it to all the previous destinations entered. The problem is that I can't work out how to return a single column 'Destination' of distinct destination values from my Booking class, e.g.
var query = from bk in ObjectContext.Bookings select new DestinationDTO { Destination = bk.Destination };
return query.Distinct();
. I have tried creating a shared DestinationDTO class to return just the single column but can't work out how to get this to inherit from Entity!!
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 DestinationDTO 类中需要有一个带有 [Key] 属性的属性。然后RIA服务就能在客户端生成相应的类。
然后就这样做:
You need to have a property with a [Key] attribute in your DestinationDTO class. Then RIA services will be able to generate a corresponding class on the client side.
Then just do this: