TAILIEUCHUNG - Professional ASP.NET 3.5 in C# and Visual Basic Part 112

Professional in C# and Visual Basic Part 112. Building on the revolutionary release, 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 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 22 State Management expensive database retrieval those UserControls can retrieve the necessary data from . The database is hit only once. When individual units within a single HttpRequest need to act on the same or similar data If the lifetime of your data is just one request consider using as a short term cache. The Items collection holds objects just like many of the collections that have been used in this chapter. You need to cast those objects back to their specific type when they are retrieved. Within a Web-aware Database Access Layer per-request caching can be quickly implemented with the simple coding pattern shown here. Note that this sample code is a design pattern and there is no MyData class it s for illustration. VB Public Shared Function GetExpensiveData ID As Integer As MyData Dim key as string data Dim d as MyData _ CType key MyData If d Is Nothing Then d New Data Go to the Database do whatever. key d End If Return d End Function C public static MyData GetExpensiveData int ID string key data MyData d MyData key if d null d new Data Go to the Database do whatever. key d return d This code checks the Items collection of the current HttpContext to see if the data is already there. If not the data is retrieved from the appropriate backing store and then stored in the Items collection. Subsequent calls to this function within the same HttpRequest receive the already-cached object. As with all optimizations and caching premature optimization is the root of all evil. Measure your need for caching and measure your improvements. Don t cache just because it feels right cache because it makes sense. 1068 Chapter 22 State Management Summary This chapter explored the many ways to manage State within your application. The Session object and its providers offer many choices. Each has its .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.