TAILIEUCHUNG - ASP.NET 4 Unleased - p 149

Tạo một BuildProvider Custom Khi bạn viết một trang và lưu các trang với hệ thống file của máy tính, các trang được biên dịch tự động vào một lớp học NET. Trong nền. Các trang web được biên dịch tự động bởi một BuildProvider. | 1454 CHAPTER 31 Working with the HTTP Runtime Creating a Custom BuildProvider When you write an page and save the page to your computer s file system the page gets compiled dynamically into a .NET class in the background. The page is compiled dynamically by a BuildProvider. The Framework includes a number of BuildProviders. Each BuildProvider is responsible for compiling a file with a particular extension located in a particular type of folder. For example there are BuildProviders for Themes Master Pages User Controls and Web Services. When a BuildProvider builds it builds a new class in the Temporary Files folder. Any class added to the folder becomes available to your application automatically. When you use Visual Web Developer any public properties and methods of the class appear in Intellisense. You can create your own BuildProviders. This can be useful in a variety of different scenarios. For example imagine that you find yourself building a lot of pages that display forms. You can tediously build each page by hand by adding all the necessary form and validation controls. Alternatively you can create a new BuildProvider that takes an XML file and generates the form pages for you automatically. Or imagine that you are spending a lot of time building data access components. For example every time you need to access a database table you create a new component that exposes properties that correspond to each of the columns in the database table. In this case it would make sense to create a custom BuildProvider that generates the data access component automatically. Creating a Simple BuildProvider Let s start by creating a simple BuildProvider. The new BuildProvider will be named the SimpleBuildProvider. Whenever you create a file that has the extension .simple the SimpleBuilderProvider builds a new class with the same name as the file in the background. The dynamically compiled class also includes a single method .

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.