Apress Expert C sharp 2005 (Phần 5)

Tham khảo tài liệu 'apress expert c sharp 2005 (phần 5)', 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 25 PM Page 174 174 CHAPTER 4 DATA ACCESS AND SECURITY In either case it is the call that ultimately triggers the data portal infrastructure to move the object to the application server so it can interact with the database. It is important to notice that the Save method returns an instance of the business object. Recall that .NET doesn t actually move objects across the network rather it makes copies of the objects. The call causes .NET to copy this object to the server so the copy can update itself into the database. That process could change the state of the object especially if you are using primary keys assigned by the database or timestamps for concurrency . The resulting object is then copied back to the client and returned as a result of the Save method. Note It is critical that the UI update all its references to use the new object returned by Save . Failure to do this means that the UI will be displaying and editing old data from the old version of the object. Data Portal Methods As noted earlier the data portal places certain constraints on business objects. Specifically it needs to know what methods it can invoke on the server. The data portal will invoke the methods listed in Table 4-10 though not all framework base classes need to implement all the methods. Collectively I ll refer to these methods as the DataPortalXYZ methods. Table 4-10. Business Object Methods Invoked by the Data Portal Method Purpose DataPortal_Create An editable business object implements this method to load itself with default values required for a new object. DataPortal_Fetch An editable or read-only business object implements this method to load itself with existing data from the database. DataPortal_Insert An editable business object implements this method to insert its data into the database. DataPortal_Update An editable business object implements this method to update its data in the database. .

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
15    87    2    21-06-2024
21    284    2    21-06-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.