Đang chuẩn bị liên kết để tải về tài liệu:
ASP.NET 4 Unleased - p 103

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Thực hiện xác thực với các học EntityBase Một đơn khiếu nại Tôi đã luôn luôn có khoảng ASP.NET Framework là xác nhận điều đó xảy ra tại địa điểm sai. Khi xây dựng các trang ASP.NET, bạn viết phần lớn các mã xác thực của bạn trong lớp giao diện người dùng thay vì lớp logic doanh nghiệp của bạn nơi mà mã xác nhận bạn đúng thuộc về. | 994 CHAPTER 20 Data Access with LINQ to SQL from the ObjectDataSource control and provides default values for several ObjectDataSource control properties. For example you could swap the ObjectDataSource control in Listing 20.33 with the following EntityDataSource control custom EntityDataSource id srcMovies TypeName Movie EnablePaging true SortParameterName orderBy Runat Server Why use the EntityDataSource control Less typing. I don t want to program all day I want to see a movie. Performing Validation with the EntityBase Class One complaint I ve always had about ASP.NET Framework is that validation happens at the wrong place. When building ASP.NET pages you write the vast majority of your validation code in the user interface layer instead of your business logic layer where your validation code properly belongs. Performing validation in your user interface layer is bad for two main reasons. First it means that if you switch user interfaces for your application you must rewrite all your validation logic. For example you might want to create a cool Silverlight interface for your application. In that case you have to write all your validation logic again from scratch. Validation logic should be user interface-independent. Also placing your validation logic in your user interface layer means that you have to rewrite the exact same validation logic on each page that you use an entity. This is an extraordinary time waster. I want to write my validation logic for an entity once and use the same logic everywhere. The EntityBase class includes a Validate method that you can use to incorporate validation logic into your entities and thus your business logic layer . Listing 20.34 illustrates how you can write the Movie class so that it validates the Title Director and DateReleased properties. LISTING 20.34 ShowEntityBase App Code Movie.cs using System public partial class Movie EntityBase Movie From the Library of Wow eBook Creating a Custom LINQ Entity Base Class 995 .

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.