Features downloading of the object data with a large number of datalow

Here is the download of all objects created in the example.

Console.WriteLine("6. Loading a dataobject with multiple details.");
            
IDataService dataService = DataServiceProvider.DataService;
OrmSample ormSample = new OrmSample(dataService);
object primaryKey = ormSample.GetSomeObjectPrimaryKey(typeof(D0));

D0 aggregator = new D0();
aggregator.SetExistObjectPrimaryKey(primaryKey);

// To speed up the boot, you can uncomment this line. 
// aggregator.DisableInitDataCopy(); 
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();

dataService.LoadObject(D0.Views.FULLD0_E, aggregator);
stopwatch.Stop();
Console.WriteLine("Time taken for loading: {0} ms.", stopwatch.ElapsedMilliseconds);

// Make sure each object in each dealova property contains 10 detailov that were stored there. 
ormSample.CheckDetailsQty(aggregator, 10);
Console.WriteLine("CheckDetailsQty: OK.");

Method code CheckDetailsQty:

internal void CheckDetailsQty(D dobj, int qtyInEach)
{
    string[] detprops = Information.GetPropertyNamesByType(dobj.GetType(), typeof(DetailArray));
    for (int i = 0; i < detprops.Length; i++)
    {
        DetailArray detarr = (DetailArray)Information.GetPropValueByName(dobj, detprops[i]);
        if (detarr.Count != qtyInEach) 
            throw new Exception(string.Format("Missing reading of {0}!", detprops[i]));

        for (int j = 0; j < detarr.Count; j++)
        {
            D obj = (D)detarr.ItemByIndex(j);
            CheckDetailsQty(obj, qtyInEach);
        }
    }
}
Переведено сервисом «Яндекс.Переводчик» http://translate.yandex.ru