Đang chuẩn bị liên kết để tải về tài liệu:
Professional ASP.NET 3.5 in C# and Visual Basic Part 115

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

Professional ASP.NET 3.5 in C# and Visual Basic Part 115. Building on the revolutionary ASP.NET 2.0 release, ASP.NET 3.5 adds several key new developer features including AJAX, LINQ, and a new CSS designer in Visual Web Developer 2008. The dramatic reduction in code that developers realized from the more than 50 new server controls in ASP.NET 2.0 now allows developers the time to make their applications more interactive with AJAX, to work with data in their preferred language with LINQ, and to build visually attractive and consistent standards-based sites with CSS. . | Chapter 23 Caching SqlConnection ConfigurationManager.ConnectionStrings AppConnectionString1 .ConnectionString SqlDataAdapter da new SqlDataAdapter Select from Customers conn myCustomers new DataSet da.Fill myCustomers SqlCacheDependency myDependency new SqlCacheDependency Northwind Customers Cache.Insert firmCustomers myCustomers myDependency Labell.Text Produced from database. else Labell.Text Produced from Cache object. GridViewl.DataSource myCustomers GridView1.DataBind script In this example the SqlCacheDependency class associated itself to the Customers table in the Northwind database as before. This time however you use the Cache object to insert the retrieved dataset along with a reference to the SqlCacheDependency object. The Insert method of the Cache class is constructed as follows Cache.Insert key As String value As Object dependencies As System.Web.Caching.CacheDependency You can also insert more information about the dependency using the following construct Cache.Insert key As String value As Object dependencies As System.Web.Caching.CacheDependency absoluteExpiration As Date slidingExpiration As System.TimeSpan And finally Cache.Insert key As String value As Object dependencies As System.Web.Caching.CacheDependency absoluteExpiration As Date slidingExpiration As System.TimeSpan priority As System.Web.Caching.CacheItemPriority onRemoveCallback As System.Web.Caching.CacheltemRemovedCallback The SQL Server cache dependency created comes into action and does the same polling as it would have done otherwise. If any of the data in the Customers table has changed the SqlCacheDependency class invalidates what is stored in the cache. When the next request is made the Cache firmCustomers is found to be empty and a new request is made to SQL Server. The Cache object again repopulates the cache with the new results generated. When the ASP.NET page from Listing 23-8 is called for the first time the results generated are shown in Figure 23-8. 1099 Chapter 23 .

TÀI LIỆU LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.