ComponentOne DataObjects for .NET
Asynchronous Fetch Modes
DataObjects for .NET (Enterprise Edition) > Virtual Mode – Dealing with Large Datasets > Asynchronous Fetch Modes

DataAccessMode = Virtual is recommended for especially large table views that not only take too much time to fetch, but also would consume too much client memory if fetched entirely to the client. In many cases the situation is somewhat different: the rowset is too large to be pre-fetched to the client at startup, that would take too much time, but it is small enough so all rows can be gradually brought to the client and stored there. For such situations, DataObjects for .NET supports two more virtual modes: VirtualUnlimited and VirtualAutomatic (DataAccessMode = VirtualAutomatic is more common, it is usually more suitable than VirtualUnlimited).

Data access mode Virtual means that data is fetched in chunks (called segments) of limited size (the size of each segment is determined by the VirtualSegmentSize property, default: 400), and the number of segments cached at the client at any given time is limited (this number is determined by the VirtualSegmentCount property, default: 4). Mode Virtual works for rowsets of virtually unlimited size, for example, in Tutorial 4 we demonstrate how it can be used to display 2.7 million rows in a grid.

Data access mode VirtualUnlimited is similar to Virtual in that data is fetched in segments, but the number of segments in the cache is unlimited, the VirtualSegmentCount property value is ignored. Once a segment is brought into the cache, it remains there. This setting is appropriate when you want to enhance performance by eliminating redundant roundtrips to the server, but it should not be used with very big rowsets if the user is expected to fetch too many segments into memory.

In VirtualAutomatic mode, data is fetched in segments, as in the previous two modes, and the number of segments in the cache is unlimited as in VirtualUnlimited mode, and, in addition to that, fetch is continually performed in background mode, asynchronously, until all data is fetched. This mode is appropriate for large rowsets that are big enough to make it undesirable to fetch all data at startup time, but not too big, so they still fit in client memory. This mode is additionally qualified by a Boolean VirtualConsolidateRows property. If it is set to True (default), then DataObjects for .NET will rebuild the rowset when fetch is complete. While fetch is incomplete, Rows contains only rows of the current segment. Once fetch is complete, Rows contains all fetched rows, the whole rowset. In the other two virtual modes, Rows always contains only rows of the current segment.

The VirtualAutomatic mode is similar to the asynchronous fetch feature of ADO, the OLE DB-based data access framework used in Visual Studio 6. ADO.NET does not support asynchronous fetch, so DataObjects for .NET VirtualAutomatic mode is useful for developers that need this feature in .NET environment. Moreover, the DataObjects for .NET VirtualAutomatic mode is superior to the ADO asynchronous mode in one important aspect: the whole rowset up to the last row becomes accessible to the user immediately. The user does not have to wait until the fetch is complete to access the last row or any other row of the rowset. If, for example, the user positions to the last row while fetch is in progress, DataObjects for .NET will immediately fetch the last segment and display it to the user, without waiting for the background fetch to reach the end of the rowset.