我有 WCF 数据服务(来自示例 MS Northwidth 数据库),我的 Android 应用程序使用代码从该服务请求数据:
NorthdataService service = new NorthdataService();
Query<Customers> query = service.createCustomersQuery("/Customers");
for (Customers cust : query){
Log.d(log_tag, "Customer Name - " + cust.getCustomerId());
}
我尝试查询客户订单:
Log.d(log_tag, "Orders - " + cust.getOrders());
并查看订单 - null
我也知道订单上的数据我可以得到一个请求:
http://Server:82/northdata.svc/Customers('ALFKI')/Orders
我尝试查询:
for (Customers cust : query){
Log.d(log_tag, "Customer Name - " + cust.getCustomerId());
String custName = "/Customers" + "('" + cust.getCustomerId() + "')" + "/Orders";
try{
Query<Customers> cquery1 = service.createCustomersQuery(custName);
for (Customers orders : cquery1){
Log.d(log_tag, "Orders2 - " + orders.toString());
}
}
catch(Exception e){}
}
我看到结果:
Orders2 - northwindmodel.Customers@40b49f68
Orders2 - northwindmodel.Customers@40c1de10
Orders2 - northwindmodel.Customers@40bdaea8
Orders2 - northwindmodel.Customers@40a6d238
如何从一个客户那里获取所有 OrderID?