从实体中检索列的子集 [英] Retrieving subset of columns from entities

查看:82
本文介绍了从实体中检索列的子集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个设置表,其中包含一个创建日期列。它还有一些外键和与表中设置相关的其他数据。


我正在使用实体数据模型。我想要两个功能 - 能够从设置表中检索所有行,就像通常的http://localhost/service.svc/settings表一样。除此之外,我希望能够根据每个外键组合的创建日期检索最近的设置
。 


我希望能够调用它RecentSettings或类似的东西。我可以在我的数据服务中公开2个相同实体类型的iqueryable吗?当我尝试这个时,我收到了一个错误。有什么替代方案。一个名为GetRecentSettings的服务操作?


我不想最终为特定实体的结果集的每个子集编写服务操作。这里最好的方法是什么?


请指教。谢谢

解决方案

最好的选择是编写服务操作。是否有特殊原因导致您不想编写服务操作?您在服务操作中编写的代码将与您在新IQueryable属性中编写的代码相同。


谢谢


Pratik


hi,

I have a settings table with a create date column in it. It also has some foreign keys and additional data associated with settings within the table.

I am using the Entity data model. I want two functionalities - Be able to retrieve all rows from settings table, like the usual http://localhost/service.svc/settings table would return. In addition to that I want to be able to retrieve most recent settings based on create date for each combo of foreign key. 

i want to be able to call it RecentSettings or something like that. Can I expose 2 iqueryables of same entity types in  my data service? I was getting an error when I tried to that. What is the alternative to that. A service operation called GetRecentSettings?

I don't want to end up writing service operations for each subset of a result set for a particular entity. What is the best approach here?

Please advise. Thanks

解决方案

The best option is to write a service operation. Is there a particular reason why you do not want to write service operation? The code you write in the service operation will be identical to the code you write in the new IQueryable property.

Thanks

Pratik


这篇关于从实体中检索列的子集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆