 |
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0  | This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

March 20th, 2009, 11:29 PM
|
|
Registered User
|
|
Join Date: Mar 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
A couple concern with CacheData
I have a couple questions with the process.
1. Why did the author hard code the keys for caching data such as
"Articles_Category_" over saving it as a variable? Is there a reason for this?
2. Protected static void CacheData(string key, object data)
Could this method just be placed in BizObject once? Was there a hidden reason I don't see in placing it in all of BizObject subclasses?
I love this book, it was so easy to understand. Is the ASP.net 3.5 version of the book coming out soon?
I am contemplating writing the DAL over and use LINQ instead. Everything will be left the same except new Database objects will be link with LINQ. Does anyone see a problem with this approach?
|
|

March 21st, 2009, 10:54 AM
|
 |
Wrox Author
|
|
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
|
|
Quote:
Originally Posted by CrazyTn
1. Why did the author hard code the keys for caching data such as
"Articles_Category_" over saving it as a variable? Is there a reason for this?
|
What advantage would be gained by using a variable? Why would you ever want to change the cache key?
Quote:
Originally Posted by CrazyTn
2. Protected static void CacheData(string key, object data)
Could this method just be placed in BizObject once? Was there a hidden reason I don't see in placing it in all of BizObject subclasses?
|
That's actually a good question. I don't see a reason it couldn't have been.
Quote:
Originally Posted by CrazyTn
I am contemplating writing the DAL over and use LINQ instead. Everything will be left the same except new Database objects will be link with LINQ. Does anyone see a problem with this approach?
|
It's been done.
http://www.wrox.com/WileyCDA/WroxTit...47041569X.html
Shouldn't be a problem then.
|
|

March 21st, 2009, 02:07 PM
|
|
Friend of Wrox
|
|
Join Date: Mar 2007
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
|
|
Quote:
Originally Posted by Lee Dumond
Originally Posted by CrazyTn http://p2p.wrox.com/images/buttons/viewpost.gif
2. Protected static void CacheData(string key, object data)
Could this method just be placed in BizObject once? Was there a hidden reason I don't see in placing it in all of BizObject subclasses?
That's actually a good question. I don't see a reason it couldn't have been.
Shouldn't be a problem then.
|
lee/crazy,
the reason for it being implemented in each base class is due to the configuration per provider i.e if you look, you'll see something along the lines of:
Cache.Insert(key, data, null, DateTime.Now.AddSeconds(BaseAccomodation.Settings. CacheDuration), TimeSpan.Zero);
so, you'd have no control over the CacheDuration per provider. a small point but may actually be desirable to have a long cache duration for some items and a short snappy one for other items (i actually cache the output of my usercontrols manually in a similar fashion but only cache them for anywhere between 60 and 120 secs - this believe it or not can have a profound impact on performance and is well worth looking implementing. this incidently is the main reason that i never use the objectdatasource to bind controls in the aspx page and instead just place a <div id="divRSS" runat="server" class="rightbox_wrapper lastbox" /> in the aspx page and in the page_load run a method that either get's the generated divs from the cache OR runs the BLL method to retireve the data and populate the markup from there. just one of my little foibles  )
hope this helps..
Last edited by jimibt; March 21st, 2009 at 02:12 PM..
|
|

March 21st, 2009, 02:19 PM
|
 |
Wrox Author
|
|
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
|
|
Good point Jimi. I should have actually looked at the BeerHouse code, would have seen that the separate implementations allow for different durations.
BTW, you do know you can cache with the ObjectDataSource, right?
|
|

March 21st, 2009, 03:24 PM
|
|
Friend of Wrox
|
|
Join Date: Mar 2007
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
|
|
Quote:
Originally Posted by Lee Dumond
Good point Jimi. I should have actually looked at the BeerHouse code, would have seen that the separate implementations allow for different durations.
BTW, you do know you can cache with the ObjectDataSource, right?
|
lee - actually, i wasn't aware of that. however, i did actually drop using the ODS quite a while back due to requireing a more flexible and controlled approach to using my BLL data (plus, i'm not a huge fan of putting logic into the aspx markup, preferring to have more direct control via methods that i can use 'proper' coding inside (and yes, i know that you can invoke code from the markup as well, but the point being that i don't want to invoke any data access code from the markup where possible). i'm some way down the road in creating a generics/lambda extension that i can use to generate the markup in the background, rather than adding it explicitly in code (i.e. i used to do stuff like currentHtml += "<div id = " + divID + moreCode; etc...)
but anyway, good point about the ODS cache, even if i'll never use it 
|
|

March 23rd, 2009, 08:44 AM
|
|
Registered User
|
|
Join Date: Mar 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I rewrote the back end to use LINQ before Jim mention it has already been done :(.
I will look at Lee's linq implementation later today.
I used Reflection in the DLL so all the basic functions such as
Create/Update, Delete, GetByID, GetAll, ect could be done without writting any code.
I also moved all the Caching Configuration to the BusinessObjects rather than put them in webconfig. In order for caching to work in the basic DLL functions
Last edited by CrazyTn; March 23rd, 2009 at 08:56 AM..
|
|

March 23rd, 2009, 09:05 AM
|
|
Registered User
|
|
Join Date: Mar 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Caching is done on server side.
Maybe I am understanding this wrong, but do we need to set a cache duration? Every time there is a change to the database, the cache item is purged out. So why do we need to refresh the data with the cache duration when there has been no changes made to the database?
|
|
 |