如何从WCF服务返回某种列表,这是我WCF服务中的方法。wcf从wcf sservice返回一个列表
我的界面:
[OperationContract]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "Locations")]
IList<Location> GetLocations();
public IList<Location> GetLocations()
{
Pazar.Data.Repositories.LocationRepository locRepository =
new Pazar.Data.Repositories.LocationRepository();
return locRepository.GetRootLocations().ToList<Location>();
}
,这我GetRootLocations
看起来像,它返回IQueryable
,我不知道如果我也许可以从我的WCF服务回报IQueryable
?
public IQueryable<Location> GetRootLocations()
{
IQueryable<Location> locations = GetAll().Where(p => !p.ID_Parent.HasValue).OrderBy(p => p.Sequence);
return locations;
}
上面的例子给我错误,它不能打开服务, – Troj 2010-09-19 20:48:38
,最有可能与您的服务无关 - 你怎么试图读取数据?你如何访问你的服务?向我们展示您的配置! (内的所有内容都是有趣的) –
2010-09-19 20:51:06
你还得到什么错误 – 2010-09-20 06:00:18