<siteMapNode url="~/Caching/ObjectDataSource.aspx"
title="ObjectDataSource Caching"
description="Explore how to cache data directly from the
ObjectDataSource control." />
<siteMapNode url="~/Caching/FromTheArchitecture.aspx"
title="Caching in the Architecture"
description="See how to cache data from within the
architecture." />
<siteMapNode url="~/Caching/AtApplicationStartup.aspx"
title="Caching Data at Application Startup"
description="Learn how to cache expensive or infrequently-changing
queries at the start of the application." />
<siteMapNode url="~/Caching/SqlCacheDependencies.aspx"
title="Using SQL Cache Dependencies"
description="Examine how to have data automatically expire from the
cache when its underlying database data is modified." />
</siteMapNode>
完成Web.sitemap文件的更新后,让我们在浏览器里查看,左边的菜单栏显示caching章节的文章
图图3:网站地图:网站地图Site Map包含了包含了Caching章节的文章章节的文章
第二步:在第二步:在Web Page页面里展示产品页面里展示产品
本文考察怎样使用ObjectDataSource控件内置(built-in)的缓存功能。在开始之前,我们首先需要创建一个页面,用一个
ObjectDataSource控件调用ProductsBLL class类获取产品信息,再用GridView控件展示出来。
首先打开Caching文件夹里的ObjectDataSource.aspx页面。从工具箱拖一个GridView控件到页面,设置其ID为
Products,再从智能标签里选择将其绑定到一个ObjectDataSource控件,ID为ProductsDataSource。设该ObjectDataSource
使用ProductsBLL class类。