Imports System.Reflection
''' <summary>
''' BaseDataAdapter is inherits from ComponentModel.Component and will be set as BaseClass for all
''' Typed TableAdapters to allow a common code base so generic procedures can be created.
''' </summary>
''' <remarks>
''' Created by: Denaes
''' Created on: 07/19/2006
''' </remarks>
Public Class BaseDataAdapter
Inherits System.ComponentModel.Component
Implements ITableAdapter
Public Sub InvokeUpdate(ByVal Table As DataTable) Implements ITableAdapter.InvokeUpdate
Debug.Print("Invoke Update procedure for " & Table.TableName & " begun.")
If Table IsNot Nothing Then
' Method to invoke.
Dim UpdateMethod As MethodInfo
' Array of Methods parameter signiture types.
Dim UpdateTypes As Type() = {Table.GetType}
' Not used, just a dummy value.
Dim UpdateModifiers() As ParameterModifier = {New ParameterModifier}
' Array of Parameters to pass into the Method being Invoked.
Dim arrUpdateParameters() As Object = {Table}
Try
' Assigns the Method matching the given signature to UpdateMethod.
UpdateMethod = Me.GetType.GetMethod("Update", UpdateTypes, UpdateModifiers)
' Invokes the UpdateMethod with the the Array of Parameters given.
UpdateMethod.Invoke(Me, arrUpdateParameters)
Catch ex As Exception
' This is a serious error and needs attention if something here fails.
MessageBox.Show("Error with InvokeUpdate: " & vbNewLine & ex.ToString)
End Try
Else
Debug.Print("Invoke Update for " & Table.TableName & " canceled. Table is nothing.")
End If
End Sub
End Class