RIA DomainService に 2 つのクエリがあります。1 つは linq を使用した単純な get で、もう 1 つは peramiter と linq join を使用した get です。include() を使用するときの単純な get は、Silverlight データグリッドに必要なデータを返します。参加しているものはそうではありません、なぜですか?
ここに私の2つの方法があります。一番上のものは機能するものです。
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();
}