Dynamic query with WCF RIA Services

不羁岁月 提交于 2019-11-29 15:56:05

For one of our scenarios we have a DomainService operation which returns xml strings, it looks something like this:

public IQueryable<WidgetInfo> GetWidgetList()
{
    IList<WidgetInfo> widgets = WidgetDatabase.GetWidgets(userId);
    return widgets.AsQueryable();
}

where WidgetInfo looks like this:

public class WidgetInfo
{
    [Key]
    public int Id;
    public string Title;
    public string WidgetData;   // Contains XML description of data
}
Doguhan Uluca

I'm going to respond to returning arbitrary data. Take a look at the discussion here: https://stackoverflow.com/a/10018119/178620

I have achieved returning arbitrary data by creating a new POCO Entity, which contains IEnumerable. And I do serialization and deserialization using Json.Net Bson, which is much faster than XML.

Update: There's also the Dynamic Linq Library (https://stackoverflow.com/a/848435/178620)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!