У меня есть два запроса в моем RIA DomainService. один из них — простое получение с использованием linq, а другой — получение с помощью peramiter и соединения linq. простое получение при использовании include() возвращает данные, которые я хочу, в мою сетку данных Silverlight. тот с присоединением не делает, почему?
вот мои два метода. верхний - тот, который работает.
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();
}