I have a usercontrol in WPF project which it execute a select query which takes a long time this is the code
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 has 30000 record it takes aound 2.5 min to load the usercontrol
Thanks Jeff Mercado
I changed the query and used eager loading query it helped a lot and reduced loading time.
var query = context.E.include("B").tostring()