Loading is Too Slow..

Posts   
 
    
Posts: 24
Joined: 01-Dec-2006
# Posted on: 19-Feb-2007 09:06:33   

platform: Visual studio .net 2005 oracle 10g llblgen 2.0

I have a problem with loading entity collections. It is too slow when there is a huge amount of entity. How can I make it faster? How can I limit the relations so that get faster?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 19-Feb-2007 10:11:02   

I need more information, so I have a couple of questions:

What exactly are you loading? Are there CLOB/BLOB fields in the entity? Do you use prefetch paths or just a single collection? How many fields are there in the entity? How many entities are you fetching?

Frans Bouma | Lead developer LLBLGen Pro
Posts: 24
Joined: 01-Dec-2006
# Posted on: 20-Feb-2007 15:50:46   

We use llblgen and Developer Express Tool.

First I fetch an entity collection. There are 120records on the grid. When user clicks one of them, a new window is opened. But that is too slow to load. Inside of this window, there is a grid. Grid has 16 fields. 8 of them are lookupedit. Therefore, for each lookupedit, one entity collection is fetched. Each of these collections have entities between 2-100.

So what can i do for best performance?

Aurelien avatar
Aurelien
Support Team
Posts: 162
Joined: 28-Jun-2006
# Posted on: 20-Feb-2007 16:02:43   

Hi,

can you show the code when you fetch entities/entitycollections ?

Posts: 24
Joined: 01-Dec-2006
# Posted on: 21-Feb-2007 08:51:39   

private void FetchEntity() { DepoEntity _enDepo = null; //new DepoEntity(); EntityCollection _encOrgFirma = new EntityCollection(new OrgFirmaEntityFactory()); EntityCollection _encOrgIsyeri = new EntityCollection(new OrgIsyeriEntityFactory()); EntityCollection _encIsletme = new EntityCollection(new IsletmeEntityFactory()); EntityCollection _encDepoIcerik = new EntityCollection(new DepoIcerikEntityFactory()); EntityCollection _encStokAlani = new EntityCollection(new StokAlaniEntityFactory()); EntityCollection _encDepoKullanici = new EntityCollection(new DepoKullaniciEntityFactory()); EntityCollection _encDepoEht = new EntityCollection(new DepoEhtEntityFactory()); EntityCollection _encEnvanterHareketTipi = new EntityCollection(new EnvanterHareketTipiEntityFactory()); EntityCollection _encDepoItem = new EntityCollection(new DepoItemEntityFactory());

        if (_sDepoKodu != "")
        {
            _enDepo = new DepoEntity(_sDepoKodu);
            _adapter.FetchEntity(_enDepo);
        }
        else
        {
            _enDepo = new DepoEntity();
            _enDepo.Durumu = "A";
            _enDepo.Kilitli = "H";
            _enDepo.LokasyonHareketFlag = "H";
        }

        RelationPredicateBucket bucketOrgFirma = new RelationPredicateBucket();
        bucketOrgFirma.PredicateExpression.Add(OrgFirmaFields.OrgFirmaKodu == global.OrgFirmaKodu);
        _adapter.FetchEntityCollection(_encOrgFirma, bucketOrgFirma);
        bsOrgFirma.DataSource = _encOrgFirma;

        RelationPredicateBucket bucketIsyeri = new RelationPredicateBucket();
        bucketIsyeri.PredicateExpression.Add(OrgIsyeriFields.OrgFirmaKodu == global.OrgFirmaKodu);
        _adapter.FetchEntityCollection(_encOrgIsyeri, bucketIsyeri);
        bsIsyeri.DataSource = _encOrgIsyeri;

        RelationPredicateBucket bucketIsletme = new RelationPredicateBucket();
        bucketIsletme.PredicateExpression.Add(IsletmeFields.OrgFirmaKodu == global.OrgFirmaKodu);
        bucketIsletme.PredicateExpression.Add(IsletmeFields.IsyeriKodu == _enDepo.IsyeriKodu);
        _adapter.FetchEntityCollection(_encIsletme, bucketIsletme);
        bsIsletme.DataSource = _encIsletme;

        _adapter.FetchEntityCollection(_encDepoIcerik, null);
        bsDepoIcerik.DataSource = _encDepoIcerik;

        RelationPredicateBucket bucketStokAlani = new RelationPredicateBucket();
        bucketStokAlani.PredicateExpression.Add(StokAlaniFields.DepoKodu == _enDepo.DepoKodu);
        _adapter.FetchEntityCollection(_encStokAlani, bucketStokAlani);
        bsStokAlani.DataSource = _encStokAlani;
        _encStokAlani.AllowNew = true;

        RelationPredicateBucket bucketDepoKullanici = new RelationPredicateBucket();
        bucketDepoKullanici.PredicateExpression.Add(DepoKullaniciFields.DepoKodu == _enDepo.DepoKodu);
        _adapter.FetchEntityCollection(_encDepoKullanici, bucketDepoKullanici);
        _encDepoKullanici.Sort(2, ListSortDirection.Ascending);
        bsDepoKullanici.DataSource = _encDepoKullanici;

        RelationPredicateBucket bucketDepoEht = new RelationPredicateBucket();
        bucketDepoEht.PredicateExpression.Add(DepoEhtFields.DepoKodu == _enDepo.DepoKodu);
        _adapter.FetchEntityCollection(_encDepoEht, bucketDepoEht);
        bsDepoEht.DataSource = _encDepoEht;

        _adapter.FetchEntityCollection(_encEnvanterHareketTipi, null);
        bsEnvanterHareketTipi.DataSource = _encEnvanterHareketTipi;

        RelationPredicateBucket bucketDepoItem = new RelationPredicateBucket();
        bucketDepoItem.PredicateExpression.Add(DepoItemFields.DepoKodu == _enDepo.DepoKodu);
        _adapter.FetchEntityCollection(_encDepoItem, bucketDepoItem);
        bsDepoItem.DataSource = _encDepoItem;
    }
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 21-Feb-2007 09:52:18   

You shouldn't fetch the whole lists of related entities for each entity again. Please take a look at the complex databinding example on the website in the examples section. The example shows you how to fetch the lookup entities once for the whole grid and how they're re-used for each row. This will greatly enhance performance for you. The example uses the normal datagridview, but it's also possible with other grids as every grid supports combo boxes and value lists.

Frans Bouma | Lead developer LLBLGen Pro