Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I would advise to use a DataSource object in your xaml, and set your list view's data source to be bound to the DataSource object. Also use a pager, (You can get one from here:http://cid-51b2fdd068799d15.office.live.com/self.aspx/.Public/Samples%5E_2010/20100929%5E_DataPagerForWPF.zip) whose data source will also be bound to the DataSource object. That wold achieve 2 things:</p> <ol> <li><p>The pager will query the data source object ensuring that it loads only x number of data elements (entities) at a time. Do not, however be fooled that if you have 5000000 entities, your data context will eventually store all of these entities in memory after the user has gone to the last page. These entities do get garbage collected.</p></li> <li><p>The data source object contains a global instance of the context which will never go out of scope until the control or window is destroyed and garbage collected.</p></li> </ol> <p>That being said here are two tips to make your life easier:</p> <ol> <li><p>Entities by default implement INotifyPropertyChanged.</p></li> <li><p>I do believe that as long as the context exists in the same memory space as the entities being modified, all you need to do is call SaveChanges() on the context to commit the changes to all modified entities. YOU DON'T HAVE TO DETACH the entities so that you can display them, modify them (well your user modifies them), then re-attach the entities to the context, and finally notify the context that the entity has changed. </p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload