如何在客户端代码访问ado.net data service?
我在网上查了些例子,自己尝试的时间为什么就老出错呢?
服务器如下:
[WebGet]public IQueryable<string> GetDefectDistinct(string defect){ IQueryable<string> result; switch (defect.ToLower()) { case "corrosion": result = (from p in this.CurrentDataSource.PLDA_CORROSION orderby p.INSPECTIONBATCH select p.INSPECTIONBATCH).Distinct(); break; case "weld": result = (from p in this.CurrentDataSource.PLDA_WELD orderby p.INSPECTIONBATCH select p.INSPECTIONBATCH).Distinct(); break; default: throw new Exception("输入参数错误"); } return result;}
private void btnTest_Click(object sender, RoutedEventArgs e){ string uri = string.Format("/GetDefectDistinct?defect='corrosion'"); IEnumerable<string> strList = PLDA.Data.DataSource.pRemoteSource.Execute<string>(new Uri(uri, UriKind.Relative)); foreach (var p in strList) { }}