Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP General (http://www.velocityreviews.com/forums/f65-asp-general.html)
-   -   Is this normal methodology? (http://www.velocityreviews.com/forums/t800333-is-this-normal-methodology.html)

Tapplication@gmail.com 12-30-2005 02:33 AM

Is this normal methodology?
 
I do not consider myself a ASP expert by any means so I must ask this
question to see if this is normal or if there is a better way.

I have a web site that I have developed that uses a lot of DB lookups
for Comboboxes and sections, as well as other configs- All in a
database.

Instead of having this done on EVERY page via direct DB lookups.... We
are talking lots of SQL lookups for every page.

What I want to do is have an included page say SiteHeader.ASPX and do
the following

If Not Application("Initialized") then
InitializeMyApplication()


InitializeMyApplication() Will Do all the database Lookups and create
dropdowns dyanmicly and assign it to a string -- say S,

Application("SiteDropDownList5") = S
Application("Initialized") = True


Then just used this dynamically generated HTML on my pages.


Please Select: <%=Application("SiteDropDownList4")%>


Is this normal?


Dale 12-30-2005 03:58 AM

RE: Is this normal methodology?
 
What you propse would certainly work, but why not use the built-in caching
capabilities of ASP.Net?

I typically let my data handler manage the caching. When a method requests,
let's say dsAccountingCodes, for populating a dropdown list, the data handler
checks the cache for a value such as Cache["AccountingCodes"]. If
Cache["AccountingCodes"] is null then the data handler goes to the database,
retrieves the accounting codes list and returns the retrieved list after
storing it for the next request in cache using Cache.Insert.

I usually expire my cached objects in 15 to 30 minutes depending on the
application. You can use timed or other cache dependencies outlined on MSDN.

The next request for the same data will come from cache with no call to the
database.

Here's a place to start:

http://msdn.microsoft.com/library/de...nCacheAPIs.asp

--
Dale Preston
MCAD C#
MCSE, MCDBA


"Tapplication@gmail.com" wrote:

> I do not consider myself a ASP expert by any means so I must ask this
> question to see if this is normal or if there is a better way.
>
> I have a web site that I have developed that uses a lot of DB lookups
> for Comboboxes and sections, as well as other configs- All in a
> database.
>
> Instead of having this done on EVERY page via direct DB lookups.... We
> are talking lots of SQL lookups for every page.
>
> What I want to do is have an included page say SiteHeader.ASPX and do
> the following
>
> If Not Application("Initialized") then
> InitializeMyApplication()
>
>
> InitializeMyApplication() Will Do all the database Lookups and create
> dropdowns dyanmicly and assign it to a string -- say S,
>
> Application("SiteDropDownList5") = S
> Application("Initialized") = True
>
>
> Then just used this dynamically generated HTML on my pages.
>
>
> Please Select: <%=Application("SiteDropDownList4")%>
>
>
> Is this normal?
>
>


Bob Barrows [MVP] 12-30-2005 09:52 AM

Re: Is this normal methodology?
 
Tapplication@gmail.com wrote:
> I do not consider myself a ASP expert by any means so I must ask this
> question to see if this is normal or if there is a better way.
>
> I have a web site that I have developed that uses a lot of DB lookups
> for Comboboxes and sections, as well as other configs- All in a
> database.
>
> Instead of having this done on EVERY page via direct DB lookups.... We
> are talking lots of SQL lookups for every page.
>
> What I want to do is have an included page say SiteHeader.ASPX and do
> the following
>
> If Not Application("Initialized") then
> InitializeMyApplication()
>
>
> InitializeMyApplication() Will Do all the database Lookups and create
> dropdowns dyanmicly and assign it to a string -- say S,
>
> Application("SiteDropDownList5") = S
> Application("Initialized") = True
>
>
> Then just used this dynamically generated HTML on my pages.
>
>
> Please Select: <%=Application("SiteDropDownList4")%>
>
>


I was about to suggest using the Cache, but Dale beat me to it. So, instead
i'll leave you with this boilerplate:

There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-knowledgeable person here who
can answer your question, you can eliminate the luck factor by posting your
question to a group where those dotnet-knowledgeable people hang out. I
suggest microsoft.public.dotnet.framework.aspnet.


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"




All times are GMT. The time now is 08:07 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.