WFC数据服务 - 加载数据问题 [英] WFC Data Service - Load Data Question

查看:85
本文介绍了WFC数据服务 - 加载数据问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我是WFC数据服务和Odata的初学者。


是否可以仅加载特定数据表。


例如,如果我有一个表Costumer我只想加载名字而不是第二个名字,地址等吗?


I认为这可以通过查询投影来实现吗?


但我认为通过查询投影我只能读取数据而不能编辑它?所以我的下一个问题是,是否可以首先使用所有数据加载整个costumer表,然后下次加载名字?


也许可以加载客户,使用查询投影加载名字并更新本地上下文?


或者有更好的方法吗?


我只是在想关于如何将数据加载到我的客户端是保存带宽的最佳方法。


谢谢。


Markus

解决方案


您可以在进行查询时进行投影。类似于:



var results = context.Query< Costumer>()。选择(c => new {c.Id,c .Name});


此查询将生成如下的SQL:


SELECT ID,NAME FROM COSTUMERS


但是,为了避免任何性能问题,请考虑分页查询,批量检索数据而不是加载整个表格。





Hi,

I am beginner with WFC Data Services and Odata.

Is it possible to load only specific data of a table.

For example if I have a table Costumer I only want to load the first name and not the second name, adress etc?

I think this will be possible with query projections?

But I think with query projections I am only able to read the data and not to edit it? So my next question is, is it possible to first load the whole costumer table with all the data and the next time just load the first name?

Maybe it is possible to load the costumer, load the first name with query projections and update the local context?

Or is there a much better way to do this?

I am just thinking about how to load the data to my client the best way to save bandwith.

Thanks.

Markus

解决方案

Hi,

You can do a projection when doing you query. Something like:

var results = context.Query<Costumer>().Select(c => new { c.Id, c.Name });

This query will generate an sql like:

SELECT ID, NAME FROM COSTUMERS

However, to avoid any performance issue, think to paging your queries, retrieving data un lots instead of loading the full table.



这篇关于WFC数据服务 - 加载数据问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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