Hello
We have a resource table which is discriminated (employee, visitor, car) which contains thousands of records and is linked to many other tables as it's the core of our system. Loading the entire object graph for all employees takes about 6 seconds which is too long. I was playing with paging to speed up initial loading of our control, but I run into an error...
I have +/- 24000 records in the resource table (10000 employees, 9000 visitors and 5000 cars). When I load the cars with code below, everything goes ok, and my grid is filled per 1000 cars. But with both visitors and employees the first 1000 records are loaded, and then I receive an error...
In attachment you see the details of the error I receive...
When I load all employees without paging, I don't have any problem...
private void LoadDataInBackGround(object o)
{
try
{
if (Paging)
{
IEntity2 en = Activator.CreateInstance(HostControl.MasterType, true) as IEntity2;
IEntityFields2 fields = new EntityFields2(1);
fields.DefineField(en.PrimaryKeyFields[0], 0);
int totalRows = Main.DataServer.Adapter.GetDbCount(fields, DefaultFilterPredicate, null, false);
int pages = (totalRows / 1000) + 1;
for (int i = 1; i <= pages; i++)
{
EntityCollection<T> entitiesToFetch = CreateEntityCollection();
entitiesToFetch.RemovedEntitiesTracker = CreateEntityCollection();
Main.DataServer.FetchEntityCollection<T>(Main.Token, entitiesToFetch, PrimaryPrefetchPath, DefaultFilterPredicate, PrimarySorter, i, 1000);
if (i == 1)
OnDataLoaded(entitiesToFetch);
else
OnMoreDataLoaded(entitiesToFetch);
}
}
else
{
EntityCollection<T> entitiesToFetch = CreateEntityCollection();
entitiesToFetch.RemovedEntitiesTracker = CreateEntityCollection();
Main.DataServer.FetchEntityCollection<T>(Main.Token, entitiesToFetch, PrimaryPrefetchPath, DefaultFilterPredicate, PrimarySorter);
OnDataLoaded(entitiesToFetch);
}
}
catch (EMFetchException ex)
{
Main.HandleError(ex, c, "LoadData()");
}
}
Best regards,
TomV