Apress Expert C sharp 2005 (Phần 9)

Tham khảo tài liệu 'apress expert c sharp 2005 (phần 9)', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 2 27 06 1 31 PM Page 374 374 CHAPTER 7 USING THE CSLA .NET BASE CLASSES Note If you re calling a remote data portal you must avoid object designs that require iDisposable. Alternatively you can modify the SimpleDataPortal class to explicitly call Dispose on your business objects on the server. Business Class Structure As you ve seen business objects follow the same sequence of events for creation retrieval and updates. Because of this there s a structure and a set of features that are common to all of them. Although the structure and features are common however the actual code will vary for each business object. Due to the consistency in structure however there s great value in providing some foundations that make it easier for the business developer to know what needs to be done. Also there are differences between editable and read-only objects and between root and child objects. After discussing the features common to all business objects I ll create templates to illustrate the structure of each type of business object that you can create based on CSLA .NET. Common Features There are some common features or conventions that should be followed when coding any business classes that will inherit from the CSLA .NET base classes. These are as follows Serializable attribute Common regions private default constructor Criteria class Let s briefly discuss each of these requirements. The Serializable Attribute All business objects must be unanchored so that they can move across the network as needed. This means that they must be marked as serializable by using the Serializable attribute as shown here Serializable public class MyBusinessClass This is required for all business classes that inherit from any of the CSLA .NET base classes. It s also required for any objects that are referenced by business objects. If a business object references an object that isn t serializable then you must be sure to mark its field with the NonSerialized attribute to .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
6    44    2    04-05-2024
Đã 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.