Silverlight DomainService не возвращает информацию от include () - PullRequest
0 голосов
/ 14 марта 2011

У меня есть два запроса в моей RIA DomainService. один - простой get с использованием linq, а другой - get с peramiter и соединением linq. простой метод get при использовании 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();
    }  

1 Ответ

0 голосов
/ 29 марта 2011

Все данные не возвращаются, потому что вы выполняете выборку, которая является просто UserProfile, а не присоединенным запросом, который вы выполняли.

...