Return specific columns in ADO.NET Data Services
- I have the following codes and I got "Request Error" message.
config.SetEntitySetAccessRule("*",EntitySetRights.All);
config.SetServiceOperationAccessRule("*",ServiceOperationRights.All);
[WebGet]
public IQueryable<customer_order> GetCustomerOrder(int CustID)
{
var qry = (from o in CurrentDataSource.Order
from c in CurrentDataSource.Customer
where o.customer_id == c.customer_id && c.customer_id == CustID
select new customer_order
{
OrderID = o.order_id,
OrderDate = o.order_date,
OrderStatus = o.status,
CustAddress = c.Address,
CustNotes = c.Notes
};
return qry.AsQueryable();
}
public class customer_order
{
public int OrderID {get; set;}
public DateTime OrderDate {get;set;}
public Boolean OrderStatus {get;set;}
public string CustAddress {get;set;}
public string CustNotes {get;set;}
}
Is this possible in ADO.NET Data Services?
Thanks,
JFJ- Moved byYichun_FengMSFTMonday, November 02, 2009 9:14 AMData Services issue (From:ADO.NET DataSet)
- Moved byAmadeo Casas - MSFT Thursday, October 29, 2009 9:01 PMWrong forum (From:ASMX Web Services and XML Serialization)
Answers
- If you're using ADO.net data services v1.0 then projections aren't supported - you can only select whole entities.
If you install ado.net data services v1.5 CTP2 then projections ARE supported and your query should work.
Dave- Marked As Answer byPratik Patel - MSFTModeratorTuesday, November 03, 2009 11:57 PM
All Replies
- Hi JFJ,
Since your thread is more related to Data Services, I'll move this thread to Data Services forum.
You will get better answer in that forum.
Thanks!
Yichun Feng
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
- Hi,
If you're getting a request error, the best way to debug the failure is to get more information about the error. For more details see for example this post: http://weblogs.asp.net/sergeyzwezdin/archive/2009/03/19/debugging-ado-net-data-services.aspx.
I tried a code very similar to yours and it works for me just fine.
Thanks,
Vitek Karas [MSFT] - If you're using ADO.net data services v1.0 then projections aren't supported - you can only select whole entities.
If you install ado.net data services v1.5 CTP2 then projections ARE supported and your query should work.
Dave- Marked As Answer byPratik Patel - MSFTModeratorTuesday, November 03, 2009 11:57 PM


