2010-10-04 71 views
0

我有一個實體數據模型和域服務(也可能是一個RIA服務 - 我不知道)是這樣的:我可以從服務器接收實體投影嗎?

[EnableClientAccess] 
public class MyService : LinqToEntitiesDomainService<NORTHWNDEntities> 
{ 
    public IQueryable<Categories> GetCategories() 
    { 
     return this.ObjectContext.Categories; 
    } 
} 

從我個人理解這個類是在服務器上的方法GetCategoriesQuery()可以從客戶端調用:

MyContext context = new MyContext(); 
IQueryable<Categories> p = context.GetCategoriesQuery(); 

我想從服務器接收的Categories實體的突起或可能是加入一些實體。

回答

0

你的意思是,從投影中返回一個匿名類型從你的方法?然後,不,因爲你不能從方法中返回任何匿名類型。你將不得不定義一個類來投影以返回它。或者你可以返回一個Tuple <>。

相關問題