DataSource for Entity Framework in WPF
Programming Guide / Virtual Mode / Unmanaged Virtual Mode Limitations
In This Topic
    Unmanaged Virtual Mode Limitations
    In This Topic

    The difference between Managed and Unmanaged options is seen when data is retrieved from the server. In Managed mode, data is retrieved when the "driving" grid needs it, for example, when the user scrolls or navigates in the grid. In Unmanaged mode data is fetched from the server (if it is not already present in the cache) on every data request a bound control makes, without taking into consideration which control makes the request and for what purpose. The data source fetches ClientViewSource.PageSize|tag=P_C1_Data_DataSource_ClientCollectionView_PageSizerows around every row that is requested from it. But it does not keep/hold those rows because (unlike in Managed mode) it does not know what rows are visible in bound controls. It holds only the current row and the last requested row (both with ClientViewSource.PageSize|tag=P_C1_Data_DataSource_ClientCollectionView_PageSizerows before and ClientViewSource.PageSize|tag=P_C1_Data_DataSource_ClientCollectionView_PageSize rows after them). All other rows are not held, that is, they can be released, evicted from cache, when Entity Framework DataSource needs to cleanup/compact the cache. In most common scenarios this cannot happen, and in general you can prevent it from happening by making sure that you

    Never bind more than one scrollable control to a data source in Unmanaged virtual mode. You can bind any number of simple (bound to a single row) controls like TextBox. You can bind any grid or list or other “scrollable” control (bound to the entire data set as opposed to a single row) as well. But you should never bind two scrollable controls that can be scrolled to two different locations (rows) in the data set that are more than ClientViewSource.PageSize|tag=P_C1_Data_DataSource_ClientCollectionView_PageSize apart from one another, because only one (the latest requested) of these rows will be held, the other can be released by Entity Framework DataSource (at unpredictable time).