SQL Server DB, Home Page with multiple user controls

  • Thread starter Thread starter Nick
  • Start date Start date
N

Nick

Hi,

I am working on an eCommerce site, and the home page is split into multiple
sections (user controls), whose data is provided from the database.
Potentially this page will be cached, but its not a user story yet, but I am
still curious to know how people might render the page on the server,
without having each user control issue its own database read query to get
its own data. Are there best practices for this type of thing these days?

Thanks,

Nick.
 
The Community Starter Kit [1] take a neat approach. All of the queries
are taken care of during the begin request event, and the code stores
the query results into data objects in the Context.Items collection.

Each control on the page looks to Context.Items for the data it needs,
instead of making a query.

http://www.asp.net/Default.aspx?tabindex=8&tabid=47
 
Scott,

Thanks for your reply. I have spent some time looking at the code, and I
*think* I understand what is going on. From what I understand, it doesnt
quite work for me, because my site is nothing like the community site. I'm
not sure I am looking in the right places, but I think that multiple
requests to the database are happening, which is what I am trying to avoid.
I think this example is overly complicated to full understand the benefits,
because I dont think I understand the code. I can appreciate the benefits
of the user control using the Context.Items to get its data, but some other
code does the data retrieval however....hmmm

Thanks Scott.

Nick.

Scott Allen said:
The Community Starter Kit [1] take a neat approach. All of the queries
are taken care of during the begin request event, and the code stores
the query results into data objects in the Context.Items collection.

Each control on the page looks to Context.Items for the data it needs,
instead of making a query.

http://www.asp.net/Default.aspx?tabindex=8&tabid=47

--
Scott
http://www.OdeToCode.com/blogs/scott/


Hi,

I am working on an eCommerce site, and the home page is split into
multiple
sections (user controls), whose data is provided from the database.
Potentially this page will be cached, but its not a user story yet, but I
am
still curious to know how people might render the page on the server,
without having each user control issue its own database read query to get
its own data. Are there best practices for this type of thing these days?

Thanks,

Nick.
 
One wants to strike an *optimal* balance between trips to the database and
session memory consumption. Where that point is will vary from real-world
application to real-world application, of course. But since your stated goal
is to *minimize* roundtrips to the database [possibly at the expense of
memory consumption] then you might consider creating a Command object that
executes a stored procedure that returns multiple tables. The multiple
tables returned by the stored procedure would fill a Dataset which could be
kept in a session variable.
Timo

Nick said:
Scott,

Thanks for your reply. I have spent some time looking at the code, and I
*think* I understand what is going on. From what I understand, it doesnt
quite work for me, because my site is nothing like the community site. I'm
not sure I am looking in the right places, but I think that multiple
requests to the database are happening, which is what I am trying to avoid.
I think this example is overly complicated to full understand the benefits,
because I dont think I understand the code. I can appreciate the benefits
of the user control using the Context.Items to get its data, but some other
code does the data retrieval however....hmmm

Thanks Scott.

Nick.

Scott Allen said:
The Community Starter Kit [1] take a neat approach. All of the queries
are taken care of during the begin request event, and the code stores
the query results into data objects in the Context.Items collection.

Each control on the page looks to Context.Items for the data it needs,
instead of making a query.

http://www.asp.net/Default.aspx?tabindex=8&tabid=47

--
Scott
http://www.OdeToCode.com/blogs/scott/


Hi,

I am working on an eCommerce site, and the home page is split into
multiple
sections (user controls), whose data is provided from the database.
Potentially this page will be cached, but its not a user story yet, but I
am
still curious to know how people might render the page on the server,
without having each user control issue its own database read query to get
its own data. Are there best practices for this type of thing these days?

Thanks,

Nick.
 
Back
Top