LINQ to ENTITY select 查询执行需要很长时间 - WPF

LINQ to ENTITY select query execution takes long time - WPF

我在 wpf 项目中有一个用户控件,它执行一个需要很长时间的 select 查询 这是代码

Entities1 context = new Entities1();                        
 ObservableCollection<E> _E = new ObservableCollection<E>();
CollectionViewSource ECollection = new CollectionViewSource();
ECollection = (CollectionViewSource)this.Resources["EResource"];
 this._E = new ObservableCollection<E>
            (from e in context.Es
             join eg in context.EQ_Gs on e.EQ_G_ID equals eg.EQ_G_ID
             join u in context.Us on e.U_ID equals u.U_ID
             join b in context.Bs on e.B_ID equals b.B_ID
             select e);           
            ECollection.Source = this._E;
            this.Grid_E.ItemsSource = this._E;
            this.Grid_E.DataContext = this._E;
            this.DataContext = ECollection; 

and table E有30000条记录 加载用户控件大约需要 2.5 分钟 如果您有任何提高性能的想法,那将对我有很大帮助 提前致谢和问候

谢谢亲爱的 Jeff Mercado

我更改了查询并使用了预加载查询,它帮助很大并减少了加载时间。 var query = context.E.include("B").tostring()