Can I receive a projection of an entity from the server?
I have an entity data model and a domain service (it may be a RIA service - I don't know) like开发者_StackOverflow this:
[EnableClientAccess]
public class MyService : LinqToEntitiesDomainService<NORTHWNDEntities>
{
public IQueryable<Categories> GetCategories()
{
return this.ObjectContext.Categories;
}
}
From what I understand this class is on the server and the method GetCategoriesQuery()
can be called from the client:
MyContext context = new MyContext();
IQueryable<Categories> p = context.GetCategoriesQuery();
I would like to receive from the server a projection of the Categories
entity or maybe a join of some entities.
You mean, return an anonymous type from your method, from a projection? Then, no, because you can't return any anonymous type from a method. You'll have to define a class to project into to return it. Or you could return a Tuple<>.
精彩评论