c# - How to get the latest records from databse using EF model and ICollectionView on datagrid? -
i asking question after weeks trying , googling , couldnt solve this.
in application, utilize ef model. have screen called transportplanning. in have datagrid bound icollection below:
icollectionview view = collectionviewsource.getdefaultview(lstordsrlsd); where lstordsrlsd list of table entity called ordsrlsd below:
list<ordsrlsd> lstordsrlsd = new list<ordsrlsd>(); i using icollectionview filtering.
i utilize timer bring latest records database below:
void timer_tick(object sender, eventargs e) { dbcontext.savechanges(); lstordsrlsd = dbcontext.ordsrlsds.where(o => o.location == millname).tolist(); view = collectionviewsource.getdefaultview(lstordsrlsd); dgrecords1.itemssource = view; } but not getting latest records database. need modified records databse.
i not using mvvm model.
every time query dbcontext entities context's cache. fresh info db must create new instance of context or phone call context's refresh method.
c# wpf
No comments:
Post a Comment