Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> LLBLGenProDataSource2 -> Performance issues
 

Pages: 1
LLBLGen Pro Runtime Framework
LLBLGenProDataSource2 -> Performance issues
Page:1/1 

  Print all messages in this thread  
Poster Message
MattWoberts
User



Location:
Lancaster, UK
Joined on:
08-Apr-2004 10:24:31
Posted:
497 posts
# Posted on: 27-May-2008 18:03:38.  
Hi,

Just to clarify, I'm not accusing LLBLGenProDataSource2 of having any performance issues, but we're having a strange time trying to work out what is wrong here...

Basically, inside a user control I am using a LLBLGenProDataSource2 object, and because I need a fine level of control with it, I specify its binding methods like so:-

Code:
     <llblgenpro:llblgenprodatasource2 ID="fuelsData" runat="server"            
        AdapterTypeName="Blah"
        DataContainerType="EntityCollection"            
EntityFactoryTypeName="Blah"
        EnablePaging="False" AllowDuplicates="False" LivePersistence="false" OnPerformGetDbCount="GetDbCount" OnPerformSelect="PerformDBSelect" OnPerformWork="PerformWork">
        </llblgenpro:llblgenprodatasource2>
    

Currently it takes about 1 second for this user control to render (this is a problem because the user control is in a repeater of about 15 items). There is no existing data for it to load up, so the PerformSelect returns 0 rows. According to SQL Profiler, all the SQL generated while displaying this user control runs ultra-fast and takes up no time at all, but somewhere there is a lag while something happens. My PerformSelect method looks like this

Code:
        protected void PerformDBSelect(object sender, PerformSelectEventArgs2 e)
        {
            IDataAccessAdapter da = DataAccessAdaptorFactory.GetDataAccessAdaptor();
            da.FetchEntityCollection(e.ContainedCollection, e.Filter, 0, e.Sorter, e.PrefetchPath);
        }


Nothing too weird there. If I comment the code out so it does nothing, I find that my user control renders almost instantly - 0.08 seconds to be exact.

I know I am asking a difficult question because there could be all-sorts going on that you don't know about, but does anyone know any common "gotcha's" that might be causing problems for me? One thing that I don't understand is that my LLBLGenProDataSource2 has a filter defined in the code behind, but when I examine the SQL Profiler outout I can see a select statement that selects all fields from the table, without any predicate specified, and one that does have the predicate - both are coming from the PerformSelect method...

Any thoughts welcome...




Matt  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14618 posts
# Posted on: 28-May-2008 10:34:36.  
Which LLBLGen Pro runtime library are you using?

To which control is the LLBLGenProDataSource bound?

Quote:
If I comment the code out so it does nothing, I find that my user control renders almost instantly - 0.08 seconds to be exact.

Do you mean commenting out the code solves the issue?
Coz this might make sense since you open a connection in each DataAccessAdapter instantiation.
So you might need to use a global DataAccessAdapter with the KeepConnectionOpen set to True.

Or maybe you need to re-design your databinding and usage of the LLBLGenProDataSource. As I think there might be other better options than to use it inside a repeater.
Maybe it would be better if you fetch all relative rows/entities and then do a client side filtering (using EntityViews).

Quote:
One thing that I don't understand is that my LLBLGenProDataSource2 has a filter defined in the code behind, but when I examine the SQL Profiler outout I can see a select statement that selects all fields from the table, without any predicate specified, and one that does have the predicate - both are coming from the PerformSelect method...

Do you mean sometimes you see the filter in SQLProfiler and sometimes not?


  Top
MattWoberts
User



Location:
Lancaster, UK
Joined on:
08-Apr-2004 10:24:31
Posted:
497 posts
# Posted on: 28-May-2008 11:27:54.  
Hi,

Thanks for the message. I have looked into this some more, and have isolated the main problem...

The filter for my DataSource is set in the user control's PreRender method. Doing it here seems to be conflicting with the DataSource control, and causing these performance problems. If I move the code that sets the filterToUse to the Page_Load, this fixes the issue, but causes another problem for me - the User Control that is inside the repeater has its properties set dynamically by binding to columns in the repeater, so at the "Page_Load" stage of the user control it appears that these properties have not yet been set. Thats why I moved the code to the Page_PreRender methods....

So, I need to find somewhere else to put this code.... any ideas?
Matt  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14618 posts
# Posted on: 28-May-2008 15:34:59.  
Quote:
the User Control that is inside the repeater has its properties set dynamically by binding to columns in the repeater, so at the "Page_Load" stage of the user control it appears that these properties have not yet been set. Thats why I moved the code to the Page_PreRender methods....

You may try the Repeater's ItemDatabound event.


  Top
MattWoberts
User



Location:
Lancaster, UK
Joined on:
08-Apr-2004 10:24:31
Posted:
497 posts
# Posted on: 28-May-2008 16:21:59.  
Sorry - the repeater is in the main aspx page - its in this repeater that I have the user control in the item template, I was looking for somewhere in the user control that I could use to set the Filter.

I think I found a way round it, I set the Filter in the PerformDBSelect and PerformDBCount like this :-

Code:
        protected void PerformDBSelect(object sender, PerformSelectEventArgs2 e)
        {
            IDataAccessAdapter da = DataAccessAdaptorFactory.GetDataAccessAdaptor();
            da.FetchEntityCollection(e.ContainedCollection, FuelTypesFilter, 0, e.Sorter, e.PrefetchPath);
        }

        private IRelationPredicateBucket FuelTypesFilter
        {
            get
            {
                if (fuelTypesFilter == null)
                {
                    fuelTypesFilter = new RelationPredicateBucket(InvoiceFields.FuelTypeId == FuelTypeId);
                    fuelTypesFilter.PredicateExpression.AddWithAndInvoiceFields.ReadingId == ReadingId);
                }
                return fuelTypesFilter;
            }
        }


This seems to sort it out, although for some weird reason I have to set this filter in the PerformSelect, PerformDBCount, and in the PreRender of the user control - otherwise I get odd errors!

Anyway, this does work, so I'm sticking with it for now Regular Smiley
Matt  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.