tailieunhanh - Expert VB 2005 Business Objects Second Edition phần 4

điểm rằng dữ liệu đã được lưu trữ trong cơ sở dữ liệu. Khi đối tượng trở nên "cũ," chìa khóa chính là cố đối tượng được coi là "bẩn", hoặc thay đổi, khi các giá trị trong các lĩnh vực của đối tượng không phù hợp với các giá trị trong cơ sở dữ liệu. Nếu các giá trị trong các lĩnh vực của đối tượng nào phù hợp | 184 CHAPTER 4 DATA ACCESS AND SECURITY Next If result Is Nothing Then Throw End If End Try End If Return result End Function Let s walk through the key parts of the process. First assuming parameters were passed in for the method the parameter types are put into a list put all param types into an array of Type Dim paramsAllNothing As Boolean True Dim types As New List Of Type For Each item As Object In parameters If item Is Nothing Then GetType Object Else paramsAllNothing False End If Next The reason for doing this is twofold. First if there is at least one parameter that is not Nothing then this list is needed for a call to reflection to get the matching method. Second the loop determines whether there actually are any non-Nothing parameters. If not the search for a matching method can only by done by parameter count not data type. Note In the general case this could be problematic because a Nothing value along with some non-Nothing values could result in an ambiguous match. For the purposes of the data portal however this is not an issue because the parameters involved are very clearly defined. If all the parameter values are Nothing then the search is done based on parameter count rather than parameter type. This is complicated however by the fact that preference is given to methods lower on the inheritance hierarchy. In other words if both a base class and subclass have methods of the same name and number of parameters preference is given to the subclass. To accomplish this the code loops through the specific class types starting with the outermost class and working up through the inheritance chain ultimately to Dim currentType As Type objectType Do Dim info As MethodInfo _ method oneLevelFlags If info IsNot Nothing Then If Then got a match so use it result info Exit Do End If End If currentType Loop Until currentType Is Nothing

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.