TAILIEUCHUNG - ASP.NET at Work: Building 10 Enterprise Projects PHẦN 2

Tiếp (Footer) Quay trở lại thư khac Trở lại "" Cuối Nếu Cuối Chức năng "" Cung cấp truy cập vào danh sách các lỗi đã được phát hiện trong quá trình xác nhận. Điều này được sử dụng cho các ứng dụng, cần phải thông báo lỗi tùy chỉnh. | Contact Manager Application 47 Next Footer Return Else Return End If End Function Provides access to the list of errors that were detected during the validation process. This is used for applications that need custom error messages. Public ReadOnly Property ValidationErrors As ArrayList Get Return m_arrErrors End Get End Property Indicates whether any validation errors were detected as the data was stored into the object. Public ReadOnly Property IsValid As Boolean Get Return 0 End Get End Property End Class Listing continued Let s go through each part of the BaseServices class so that you understand what each method and property is doing for the derived classes. Writing the Class Declarations The BaseServices class itself is defined as shown Public MustInherit Class BaseServices The MustInherit keyword indicates that this class cannot be created. The only place that we can use this class is as a base class for other classes. Thus other classes that inherit it can use the services provided by this class. The next part is an ArrayList variable defined as follows Private m_arrErrors As ArrayList 48 Project 2 The variable is declared as Private since we aren t going to access it directly outside of this class or any derived classes instead you ll create a property procedure to access it from this class. Private variables are not available in derived classes instead you have to access them using properties also located in the base class. Write the Class Methods and Properties The BaseServices class provides important functionality to the business object classes you will build later in this project. It knows how to communicate with the database so that we don t have to write the same tedious code repeatedly as we build the various classes. We re using a number of new features included in the .NET Framework to handle database activity so let s go through each method in more detail now. New .

TỪ KHÓA 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.