Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Sức khỏe - Y tế
Văn bản luật
Nông Lâm Ngư
Kỹ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Giới thiệu
Đăng ký
Đăng nhập
Tìm
Danh mục
Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Y tế sức khỏe
Văn bản luật
Nông lâm ngư
Kĩ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Thông tin
Điều khoản sử dụng
Quy định bảo mật
Quy chế hoạt động
Chính sách bản quyền
Giới thiệu
Đăng ký
Đăng nhập
0
Trang chủ
Công Nghệ Thông Tin
Kỹ thuật lập trình
ASP.NET 4 Unleased - p 115
Đang chuẩn bị liên kết để tải về tài liệu:
ASP.NET 4 Unleased - p 115
Huy Chiểu
120
10
pdf
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
1114 CHAPTER 23 Using Site Maps DataRow[] results = siteMapTable.Select(“ParentId=” + parentNode.Key); foreach (DataRow row in results) { SiteMapNode node = new SiteMapNode(this, row[“Id”].ToString(), row[“url”].ToString(), row[“title”].ToString(), row[“description”].ToString()); AddNode(node, parentNode); BuildSiteMapRecurse(siteMapTable, node); } } } } Like the custom Site Map provider that was created in the previous section, the SqlSiteMapProvider derives from the base StaticSiteMapProvider class. The SqlSiteMapProvider class overrides three methods of the base class: Initialize(), GetRootNodeCore(), and BuildSiteMap(). The Initialize() method retrieves a database connection string from the web configuration file. If a database connection string cannot be retrieved, the method throws a big, fat exception. Almost all the work happens in. | 1114 CHAPTER 23 Using Site Maps DataRow results siteMapTable.Select ParentId parentNode.Key foreach DataRow row in results SiteMapNode node new SiteMapNode this row Id .ToString row url .ToString row title .ToString row description .ToString AddNode node parentNode BuildSiteMapRecurse siteMapTable node Like the custom Site Map provider that was created in the previous section the SqlSiteMapProvider derives from the base StaticSiteMapProvider class. The SqlSiteMapProvider class overrides three methods of the base class Initialize GetRootNodeCore and BuildSiteMap . The Initialize method retrieves a database connection string from the web configuration file. If a database connection string cannot be retrieved the method throws a big fat exception. Almost all the work happens in the BuildSiteMap method. This method loads the contents of the SiteMap database table into an ADO.NET DataTable. Next it recursively builds the Site Map nodes from the DataTable. There is one special aspect of the code in Listing 23.18. It uses a SQL cache dependency to automatically rebuild the Site Map when the contents of the SiteMap database table are changed. To enable SQL cache dependencies for a database you must configure the database with either the enableNotifications tool or the aspnet_regsql tool. Use the enableNotifications tool when enabling SQL cache dependencies for a SQL Express database table and use the aspnet_regsql tool when enabling SQL cache dependencies for the full version of Microsoft SQL Server. NOTE To learn more about configuring SQL cache dependencies see Chapter 29 Caching Application Pages and Data. To enable SQL cache dependencies for a SQL Express database named SiteMapDB that contains a table named SiteMap browse to the folder that contains the SiteMapDB.mdf file and execute the following command from a Command Prompt enableNotifications SiteMapDB.mdf SiteMap From the Library of Wow eBook Creating Custom Site Map Providers 1115 You can configure your website .
TÀI LIỆU LIÊN QUAN
crossorigin="anonymous">
Đã 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.