简体   繁体   English

实体框架4-按外国实体排序

[英]Entity Framework 4 - Sorting by foreign entity

I get 我懂了

'System.Windows.Data.BindingListCollectionView' view does not support sorting

when I use the following CollectionViewSource: 当我使用以下CollectionViewSource时:

    <CollectionViewSource Source="{Binding Path=CourseSessions}" x:Key="cvsCourses">
        <CollectionViewSource.SortDescriptions>
            <ComponentModel:SortDescription PropertyName="StartDate"/>
        </CollectionViewSource.SortDescriptions>
    </CollectionViewSource>

The DataContext is an ObservableCollection<Course> . DataContext是一个ObservableCollection<Course> I am using Entity Framework 4 and CourseSessions is a property of Course: 我正在使用Entity Framework 4,CourseSessions是Course的属性:

public ObjectSet<CourseSession> CourseSessions

How can I specify sorting in this case, short of sorting the data coming out of the database? 在这种情况下,如何对排序进行排序,而不对从数据库中出来的数据进行排序?

I think the problem is that ObjectSet does not support sorting. 我认为问题在于ObjectSet不支持排序。 Please, have a look to this article by Nicholas Romanidis: Using a CollectionViewSource to display Master-Detail sorted EntityCollections 请看看Nicholas Romanidis的这篇文章: 使用CollectionViewSource显示按主从排序的EntityCollections

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM