Test of null values

Posts   
 
    
Sylvain
User
Posts: 1
Joined: 14-Feb-2006
# Posted on: 15-Feb-2006 15:09:57   

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

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 15-Feb-2006 15:21:57   

Please refer to LLBLGen Pro documentation Read Entities, NULL values and defaults Under "Using the generated code -> Adapter/SelfServicing -> Using the entity classes"