您可以创建一个新类来表示您需要从服务方法获得的结果。比方说:
public class MyCustomerResult
{
public int CustomerID{get;set;}
public string CustomerName{get;set;}
public DateTime? OrderDate{get;set;}
}
然后创建一个返回新类的方法
public IQueryable<MyCustomerResult> GetMyCustomerByLastName(string startingLastNameLetter)
{
//you should modify query to return data that you need, this is only example
var q = from customer in this.ObjectContext.Customers
from order in this.ObjectContext.Orders
where c.CustomerID = o.CustomerID
select new MyCustomerResult
{
CustomerID=c.CustomerID,
CustomerName=c.CustomerName,
OrderDate=o.OrderDate
}
return q;
}