2011-03-13 2 views
0

내 RIA DomainService에 두 개의 쿼리가 있습니다. 하나는 linq를 사용하는 간단한 get이고 다른 하나는 peramiter와 linq join을 사용하는 get입니다. include()를 사용하면 Silverlight DataGrid에 원하는 데이터를 반환합니다. 그 조인이없는 사람은 왜?Silverlight DomainService가 include()에서 정보를 반환하지 않음

여기 내 두 가지 방법입니다. 가장 중요한 것은 작동하는 것입니다.

public IQueryable<UserProfile> GetUserProfiles() 
    { 
     // GetUserProfiles order by sum of carma 
     return from up in ObjectContext.UserProfiles.Include("PriceRange") 
       where up.Active 
       orderby up.SumKarma descending 
       select up; 
    } 

    public IQueryable<UserProfile> GetUserProfilesByCountyID(int searchCountyID) 
    { 
     return from up in ObjectContext.UserProfiles.Include("PriceRange") 
       join upsc in ObjectContext.UserProfileSearchCounties on up.IDUserProfile equals upsc.IDUserProfile 
       where up.Active && upsc.IDSearchCounty == searchCountyID 
       orderby up.SumKarma descending 
       select up; 

    } 

업데이트 : Cubicle.Jockey의 의견이 작업을 수행 할 수있었습니다. 아래에 내가 결국 사용하는 것입니다. 당신이에서 선택하고 있기 때문에 모든 데이터가 반환되지 않는

public IEnumerable<UserProfileSearchCounty> GetUserProfilesByCountyID(int searchCountyID) 
    { 
     return (from upsc in ObjectContext.UserProfileSearchCounties.Include("UserProfile").Include("UserProfile.PriceRange") 
       where upsc.UserProfile.Active && upsc.IDSearchCounty == searchCountyID 
       orderby upsc.UserProfile.SumKarma descending 
       select upsc).ToList(); 
    } 

답변

0

는 최대 USERPROFILE 아니라 당신이 수행 한 결합 된 쿼리 단지입니다.

+0

도움 주셔서 감사합니다. – FlyTigert