How can I test that field of my entity is null ?
Could you tell me what's wrong with the following code ?
Public Shared Function IsPropertyNull(ByVal entity As EntityBase2, ByVal propertyName As String) As Boolean
Dim index As Integer = entity.Fields.Item(propertyName).FieldIndex
Dim info As MethodInfo = Nothing
If entity.Fields.Item(propertyName).IsChanged() Then
info = entity.GetType().GetMethod("TestCurrentFieldValueForNull")
Else
info = entity.GetType().GetMethod("TestCurrentFieldValueForNull")
End If
Dim value As Object = info.Invoke(entity, BindingFlags.InvokeMethod, Nothing, New Object() {index}, Nothing)
Return CType(value, Boolean)
End Function